Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Bar Types

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Custom Bar Types

    I'm trying to port some custom bar types I have for NT7 into NT8. The 1st one I ported ( called DayPlusBarsType ) has an error at runtime:

    2015-10-22 19:07:01:669|3|16|Multiple Bartypes with the same BarsPeriodType were found. Ignoring NinjaTrader.NinjaScript.BarsTypes.DayPlusBarsType

    Code:
    	protected override void OnStateChange()
    		{
    			if (State == State.SetDefaults)
    			{
    				Name						= Custom.Resource.NinjaScriptBarsTypeDay;
    				BarsPeriod					= new BarsPeriod { BarsPeriodType = BarsPeriodType.Day };
    				BuiltFrom					= BarsPeriodType.Day;
    				DaysToLoad					= 365;
    				IsIntraday					= false;
    			}
    			else if (State == State.Configure)
    The BarsPeriodType enum doesn't have any "custom" members. So I used an integer value of 99 and cast it to BarsPeriodType like this:

    Code:
    BarsPeriod	= new BarsPeriod { BarsPeriodType = (BarsPeriodType)99};//BarsPeriodType.Day };
    Now I don't get the runtime error. However I have 2 bartypes labels "Day" in the dropdown list of Dataseries Bars in the Strategy Analyzer.

    #2
    The "Name" is using a custom resources which looks up a localized string called "Day". You can simply replace that with a string value you wish to display on the UI
    MatthewNinjaTrader Product Management

    Comment


      #3
      That worked. Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, Yesterday, 10:06 AM
      0 responses
      14 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      11 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      9 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      4 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      31 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X