Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Daily Bars with Add() method using wrong Session Template

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

    Daily Bars with Add() method using wrong Session Template

    Hi guys,
    I have a fairly standard strategy Initialize() area, in which the following line exists:

    Code:
    Add(PeriodType.Day,1);
    The first time OnBarsUpdate() is called, I do a diagonistic printout of what we've got loaded in the BarsArray. Here is that code:

    Code:
    for (int a = 0; a<BarsArray.Length; a++)
    					Print(this.Name+" Bars "+a+" "+BarsPeriods[a].ToString()+" contains "+BarsArray[a].Count+" "+BarsArray[a].Session.TemplateName+" bars, session is "
    								+BarsArray[a].Session.NextBeginTime.TimeOfDay+" to "+BarsArray[a].Session.NextEndTime.TimeOfDay);
    Unfortunately, there appears to be a problem with how Ninja loads Day data. Despite the session template for the Bars being shown correctly as "US Equities RTH", the Start and End time for the data is 24 hours, midnight through midnight. This is throwing out the calculations in the strategy. It seemeth to be a bug.

    Bars 0 1 Min contains 7410 US Equities RTH bars, session is 01:30:00 to 08:00:00
    Bars 1 Daily contains 35 US Equities RTH bars, session is 00:00:00 to 00:00:00
    Cheers,
    saltminer

    #2
    Hi saltminer, I would actually expect that outcome, reason being that day bars not build according to any session template hours - you get the session hours on the bar the your provider natively records the data with, so the return would be accurate. If you want to build a custom day according to a template set, just emulate them for example via minute data in your script.

    Comment


      #3
      Hi saltminer,

      I have observed the same thing. If you want daily data for sessions other than RTH, You will need to extract the data yourself.

      RJay
      RJay
      NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      56 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X