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 sidlercom80, 10-28-2023, 08:49 AM
      170 responses
      2,273 views
      0 likes
      Last Post sidlercom80  
      Started by Irukandji, Yesterday, 02:53 AM
      2 responses
      17 views
      0 likes
      Last Post Irukandji  
      Started by adeelshahzad, Today, 03:54 AM
      0 responses
      3 views
      0 likes
      Last Post adeelshahzad  
      Started by CortexZenUSA, Today, 12:53 AM
      0 responses
      3 views
      0 likes
      Last Post CortexZenUSA  
      Started by CortexZenUSA, Today, 12:46 AM
      0 responses
      1 view
      0 likes
      Last Post CortexZenUSA  
      Working...
      X