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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      63 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      35 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      54 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      61 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      48 views
      0 likes
      Last Post CarlTrading  
      Working...
      X