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 Mindset, Today, 06:46 AM
      0 responses
      8 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, Yesterday, 05:21 PM
      0 responses
      14 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      15 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      82 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      48 views
      0 likes
      Last Post PaulMohn  
      Working...
      X