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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      661 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      375 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      110 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      580 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X