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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      29 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      46 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      38 views
      0 likes
      Last Post CarlTrading  
      Working...
      X