Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Can't get session information for 2nd instrument

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

    Can't get session information for 2nd instrument

    Hello Support Forum,

    I'm building a strategy with two instruments that are on different sessions. One is an stock and the other a future.

    When I try to get session information on the second instrument it only gives me the session information the strategy was set to.

    I'm using the following to set the session and retrieve the session information.
    BarsArray[1].Session.TemplateName = "US equity ETH"
    in OnStartUp()

    and

    Code:
    if (Bars.FirstBarOfSession && BarsInProgress == 1)
    			{
                    Bars.Session.GetNextBeginEnd(Times[1][0], out SecondaryInstrumentSessionBegin, out SecondaryInstrumentSessionEnd);
    			}
    in OnBarUpdate() to get the session start and end for the secondary instrument. The session information for BarsArray[1] shows the right name and timezone, but returns the wrong time for the session begin and end.

    Is there any way to get this to work?

    Thanks!
    daqu40
    NinjaTrader Ecosystem Vendor - QTradez

    #2
    Hello,

    Thanks for your post.

    Unfortunately, you are correct, in NT7 there is not a way to do this. The session for your strategy would be for the primary instrument only. This was a commonly requested feature for NT7 and was made possible in NT8 by using AddDataSeries() instead of NT7's Add() method.

    NT8 Code Breaking Changes
    https://ninjatrader.com/support/help...ng_changes.htm

    One thing you could potentially do is make your strategy use the "Default 24/7" session template, and then define multiple sessions using logic.

    Please let me know if you have any further questions.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh,

      I just wanted confirmation before I built the session logic for the secondary data series.

      I was aware NinjaTrader 8 doesn't have this limitation and I'm working to get on that platform to avoid this and other limitations of 7.
      daqu40
      NinjaTrader Ecosystem Vendor - QTradez

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,606 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      8 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      4 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      14 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X