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 kinfxhk, 07-13-2026, 10:18 AM
      0 responses
      33 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 09:50 AM
      0 responses
      29 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 07:21 AM
      0 responses
      36 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-11-2026, 02:11 AM
      0 responses
      33 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      141 views
      0 likes
      Last Post SalmaTrader  
      Working...
      X