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 jaybedreamin, Today, 05:56 PM
          0 responses
          3 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Working...
          X