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

How to get current session with SessionIterator

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

    How to get current session with SessionIterator

    I'm developing both indicators and strategies that need to know when I'm in a session. I've written it like it is written in the language reference and works great except one aspect. When I tell it to GetNextSession(Time[0]), it does that. But I want it to get the current session. I am putting the call within a IsFirstBarOfSession​ block. Should I not? How do I get the current session?

    #2
    Hello dweems,

    Thanks for your post.

    You can get a template by name with TradingHours.Get(string instrumentName).

    There is an example of this in the help guide on the BarsRequest page.
    https://ninjatrader.com/support/help...arsrequest.htm

    The sessionIterator would provide the start and end session times with ActualSessionBegin and ActualSessionEnd.
    https://ninjatrader.com/support/help...oniterator.htm

    Let me know if I may assist further.​
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      I could be wrong but I think this is what you are looking for: https://ninjatrader.com/support/help...sinsession.htm

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ETFVoyageur, Today, 07:55 PM
      0 responses
      6 views
      0 likes
      Last Post ETFVoyageur  
      Started by janio973, Today, 07:24 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by aligator, 01-06-2022, 12:14 PM
      4 responses
      242 views
      0 likes
      Last Post john_44573  
      Started by reynoldsn, Today, 05:56 PM
      0 responses
      13 views
      0 likes
      Last Post reynoldsn  
      Started by bortz, 11-06-2023, 08:04 AM
      51 responses
      1,996 views
      0 likes
      Last Post aligator  
      Working...
      X