Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

default trading hours

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

    default trading hours

    hi
    In a script for NT8 i need the open trading time and the close trading time ( in terms of my local time zone) of the default session which is attach to the master instrument.
    i.e. regardless of the session of the chart.

    How it can be done ?

    #2
    Hello,

    In order to do this, you can access the Sessions collection within the TradingHours attached to MasterInstrument, like so:

    Code:
    Instrument.MasterInstrument.TradingHours.Sessions[0].BeginTime
    This will pull the BeginTime of a particular session in the instrument's default Trading Hours template, regardless of what is configured on your chart. Note that there are other properties exposed for each session, as well, such as EndTime, BeginDate, etc.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      thx

      How can i convert this to my local time zone ?

      Comment


        #4
        There are a variety of properties available on TradingHours objects related to the timezone of the Trading Hours template, and I recommend using those as a starting point to convert to your local time.

        The Instrument.MasterInstrument.TradingHours.TimeZoneI nfo.BaseUtcOffset property should prove especially useful. This provides a TimeSpan object showing the offset between UTC and the timezone configured in the Trading Hours template. With that information, and knowing the offset between UTC and your own time zone, you should be able to determine the number of hours to add or subtract from the Trading Hours timezone to convert to your local timezone.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          thx , it works fine

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Brevo, Today, 01:45 AM
          0 responses
          3 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          3 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          239 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          384 views
          1 like
          Last Post Gavini
          by Gavini
           
          Started by oviejo, Today, 12:28 AM
          0 responses
          6 views
          0 likes
          Last Post oviejo
          by oviejo
           
          Working...
          X