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 burtoninlondon, Today, 12:38 AM
          0 responses
          5 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          14 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Yesterday, 08:42 PM
          0 responses
          11 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Yesterday, 07:51 PM
          0 responses
          13 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,983 views
          3 likes
          Last Post jhudas88  
          Working...
          X