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 DannyP96, 05-18-2026, 02:38 PM
      1 response
      83 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      143 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      83 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      256 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      334 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X