Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Historical current session

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

    Historical current session

    How can we access the actual session start and end time when we are looking at historical data ?

    SessionIterator.ActualSessionBegin and ActualSessionEnd is looking at real time session.


    Thank you

    #2
    Hello,

    The key is to call GetNextSession() before trying to access ActualSessionBegin or ActualSessionEnd. Without this, these properties will return values for the current session.

    You can find a working code example showing this in action at the post linked below:

    http://ninjatrader.com/support/forum...ad.php?t=75036
    Last edited by NinjaTrader_DaveI; 10-12-2015, 03:58 PM.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      This is what I needed

      Thank you Dave

      Comment


        #4
        TradingHours.Sessions[0].BeginTime integer

        In NT8 the session begin times are accessible like this:

        int beginTime = Bars.BarsSeries.TradingHours.Sessions[0].BeginTime;

        Because the data type is an integer ( int beginTime ) the hours and minutes are expressed in a manner that I'm not familiar with how to process.

        For example, The value returned for the US Stock Index futures RTH template is: 830. This is supposed to represent 8:30 am.

        I usually use TimeSpan objects to represent time. The TimeSpan class can parse a time from a string such as "8:30" and return a TimeSpan instance. The TimeSpan class does have a method ( that I could find ) that knows how to convert an integer value 830 into a TimeSpan instance representing "8:30" am.

        Is there another API that I should be using to get the session times?

        Comment


          #5
          Hello Brillo,

          Utilizing Bars.SessionIterator.ActualSessionBegin will return a DateTime object that represents the beginning of the trading session.

          Using GetNextSession() before trying to access ActualSessionBegin will allow you to access previous sessions.

          For more information about these, here are some helpful links to the NinjaTrader 8 help guide:

          Zachary G.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mindset, Today, 06:46 AM
          0 responses
          8 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, Yesterday, 05:21 PM
          0 responses
          14 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          15 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          82 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          48 views
          0 likes
          Last Post PaulMohn  
          Working...
          X