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 CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          48 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          30 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          99 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          177 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          170 views
          0 likes
          Last Post CarlTrading  
          Working...
          X