Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Session Time Frame for added instruments

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

    Session Time Frame for added instruments

    Hi Folks!
    It's hard to find so I open a new thread.
    Developing a multi instrument code, I have the right session time for Stocks (9:30 am to 4:00pm) when BarsArray = 0, but when it access other than 0, it seems session equal 'Default 24x7'.


    Is there any setting for sessions template?
    I tried this code below:
    Print(CurrentDayOHL(BarsArray[1]).CurrentOpen[0]);
    Print(PriorDayOHLC(BarsArray[1]).PriorClose[0]);



    I got the same result or 1 tick close, never shows me the gap.



    Thanks
    mcosta72
    NinjaTrader Ecosystem Vendor - Quant-Wise

    #2
    Hello mcosta72,

    Thanks for your post.

    Regarding the session templates, this note in the NT7 helpguide applies: If a multi-series script adds an additional Bars object that already exists on the chart, the script will use the preexisting series instead of creating a new one to conserve memory. This includes that series' session template as applied from the chart. If the Bars object does not exist on the chart, the session template of the added Bars object will be the session template of the primary Bars object. If the primary Bars object is using the "<Use instrument settings>" session template then the additional Bars objects will use the default session templates as defined for their particular instruments in the Instrument Manager. the note can be found in the section, "True Event Driven OnBarUpdate() Method" here: https://ninjatrader.com/support/help...nstruments.htm


    Based on this specific line: "If the primary Bars object is using the "<Use instrument settings>" session template then the additional Bars objects will use the default session templates as defined for their particular instruments in the Instrument Manager.", you may want to set the session template for the chart series from its default to US_Equities_RTH to force the other series to follow.


    You might try the following code for finding the gap:

    if (Bars.FirstBarOfSession)
    {
    myCurrentOpen = Open[0]; // get the session current open price
    myPriorClose = Close[1]; // get the last close price of prior session
    }


    I'm just using myCurrentOpen and myPriorClose as two double variables.

    Comment


      #3
      Thanks you PAUL!
      mcosta72
      NinjaTrader Ecosystem Vendor - Quant-Wise

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X