Announcement

Collapse
No announcement yet.

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.​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

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