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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      94 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      140 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      125 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      74 views
      0 likes
      Last Post PaulMohn  
      Working...
      X