• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

FirstBarOfSession true twice in a day

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

    FirstBarOfSession true twice in a day

    I am using FirstBarOfSession to reset a counter at the beginning of each trading session. However, I've noticed that it returns to true at least twice a day; once at the beginning and again about an hour (give or take) later. Am I misunderstanding FirstBarOfSession?

    #2
    Hello ricktek,

    FirstBarOfSession is going to be based on what session template that you are using, so it would be possible to have multiple FirstBarOfSession. For example, if you use the ES the default Session Template (CME US Index Future ETH) is going to start at 5:00 PM CT Sunday through Thursday so you can expect the FirstBarOfSession to happen on 1 time each day at 5:00 PM CT.

    Another example would be the YC (Mini-size Corn) that uses a different session template (CBOT Agriculturals Mini ETH) which would happen once on Sunday at 6:00 PM CT, twice on Monday through Thursday at 9:30 AM CT and 6:00 PM CT, and once again on Friday at 9:30 AM CT.

    You may view/edit/create session templates in the Session Manager window. You may access the Session Manager by going to Tools > Session Manager. Below is a link to the Session Manager section of our help guide.

    * http://www.ninjatrader.com/support/h...on_manager.htm
    JCNinjaTrader Customer Service

    Comment


      #3
      I understand that and it all makes sense. My code simply resets a counter:
      if (FirstBarOfSession)
      counter = 0;

      The counter is being reset twice at the beginning of the session and again approx. one hour later. That, I was not expecting.

      Comment


        #4
        Hello ricktek,

        What session template are you using?

        Also could you clarify what you are expecting?
        JCNinjaTrader Customer Service

        Comment


          #5
          It happened using Default 24/7 and Forex. I was expecting that FirstBarOfSession == true when current bar is the first bar of the session (i.e., the current bar's time is the same as the time of the beginning of a session). I was not expecting FirstBarOfSession == true at any other time.

          Comment


            #6
            Hello ricktek,

            Thanks for the clarification.

            The FirstBarOfSession does not have to be at the same time as the beginning of the Session template it just has to be the first bar at the time of the new session or greater. So if data is only available after 5:00 PM CT using then even using the Default 24/7 Session Template the FirstBarOfSession will be at 5:01 PM CT.

            NinjaTrader Charts also work off of your PC Clock settings and time zone so it depending on what time zone you have your clock set to it could be possible to have 2 FirstBarOfSession in one day.

            Example: Using an ES 06-13 1 Minute Chart. Time Zone on PC set to Central Time. Loading back 5 days worth of data. You will get the following time stamps for the FirstBarOfSession (FBOS)

            FBOS: 4/21/2013 5:01:00 PM
            FBOS: 4/21/2013 11:01:00 PM
            FBOS: 4/22/2013 11:01:00 PM
            FBOS: 4/23/2013 11:01:00 PM
            FBOS: 4/24/2013 11:01:00 PM
            FBOS: 4/25/2013 11:01:00 PM

            So you would have 2 FBOS since data would start at 5:00 PM CT on Sunday 04/21/2013 which would be the first one, and 1 again at 11:01 PM CT which would be when the next Session Break would be since the Default 24/7 Session Template is defined as 12:00 AM to 12:00 AM ET. So there would be a 1 hour time difference.
            JCNinjaTrader Customer Service

            Comment


              #7
              There is a one hour difference between my PC's time and ET so that more or less explains it. I assume there is probably a small difference between my PC's time and ET to which NT has access; that would explain why it is not exactly a one hour difference. Thanks for the info. Come Monday, I'll find a work around.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by canuck, Yesterday, 07:52 PM
              0 responses
              2 views
              0 likes
              Last Post canuck
              by canuck
               
              Started by itrader46, 10-21-2019, 11:12 PM
              2 responses
              17 views
              0 likes
              Last Post koganam
              by koganam
               
              Started by walter739, Yesterday, 06:04 PM
              0 responses
              3 views
              0 likes
              Last Post walter739  
              Started by MarkWise, Yesterday, 03:04 PM
              2 responses
              8 views
              0 likes
              Last Post MarkWise  
              Started by maltese, Yesterday, 02:38 PM
              2 responses
              11 views
              0 likes
              Last Post maltese
              by maltese
               
              Working...
              X