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 cre8able, Yesterday, 01:16 PM
          3 responses
          11 views
          0 likes
          Last Post cre8able  
          Started by ChartTourist, Today, 08:22 AM
          0 responses
          6 views
          0 likes
          Last Post ChartTourist  
          Started by LiamTwine, Today, 08:10 AM
          0 responses
          2 views
          0 likes
          Last Post LiamTwine  
          Started by Balage0922, Today, 07:38 AM
          0 responses
          5 views
          0 likes
          Last Post Balage0922  
          Started by JoMoon2024, Today, 06:56 AM
          0 responses
          6 views
          0 likes
          Last Post JoMoon2024  
          Working...
          X