Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Session Start Time

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

    Session Start Time

    I am looking for the equivilant to TradeStation's Sess1StartTime reserve word. What is the best method to find the session start time in NinjaTrader?

    #2
    Hello,

    Thank you for your note.

    I am not familiar with TS, however try this:

    Use FirstBarOfSession:


    Then use Time[0] to get the time.
    DenNinjaTrader Customer Service

    Comment


      #3
      How to use FirstBarOfSession

      How can we test FirstBarOfSession in the simulated data feed environment ? Here I always get False.

      If I use Time[0], then it is giving the system time than the session start time.

      If we want to get a specific session like, 1st session or 2nd session how can I achieve the same in NT. In Tradestation we have the functions like SessionStartTime(1,2) means, the second session's start time.

      Comment


        #4
        Hello,

        Yes, the simulated data feed doesn't have sessions. Try connecting to another data feed so the session times will work.

        >>If I use Time[0], then it is giving the system time than the session start time.

        I am sorry I don't understand the above statement. As soon as you get to the first bar of the session Time[0] return the time of the first tick of the first bar of the session, which is what I thought you wanted. You could also use Open[0] of that bar.

        It sounds like you are trying to find the session begin times retroactively. For this you may need to loop backward with a "for" loop through the bars until FirstBarOfSession returns true then use the for loop index like this Open[i] (where "i" is your for loop index) to find the time for that bar and the start of that session. I'm not aware of any easier way. However I will have someone double check this for you.
        DenNinjaTrader Customer Service

        Comment


          #5
          You could also use SessionBreak and store the time stamp then if it returns true - http://www.ninjatrader-support.com/H...sionBreak.html

          Generally sessions can be set from the 'Chart Properties' - http://www.ninjatrader-support.com/H...roperties.html

          Comment


            #6
            Thank you !

            Thank you for the suggestions. I believe Bars.GetSessionBar(1) will give the first bar in the 2nd session information. I am getting the time of Bars.GetSessionBar(1).Time if (Bars.GetSessionBar(1) != null).

            Is this code has any problems to access individual session begin times ?

            Comment


              #7
              Hi Kirannarik, unfortunately this is not supported - you will need debug your custom code and make sure it works as expected, for proper debugging techniques please review this tip - http://www.ninjatrader-support2.com/...ead.php?t=3418

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              571 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              331 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              549 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              549 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X