Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

FirstBarOfSession

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

    FirstBarOfSession

    I want to reset variables for each new day. This is what I'm doing the first thing in OnBarUpdate


    if (BarsInProgress != 0)
    return;

    if (Bars.FirstBarOfSession && FirstTickOfBar)
    Print(Time[0]);

    That should print a timestamp for the first bar of each day. It isn't. Following is what it prints. It misses days and I don't mean saturday; It prints more than one time for some days; and it prints times that aren't the first bar. I'm using a 3 min chart.
    1/2/2011 11:03:00 PM
    1/3/2011 11:03:00 PM
    1/4/2011 11:03:00 PM
    1/5/2011 11:03:00 PM
    1/6/2011 11:03:00 PM
    1/9/2011 5:03:00 PM
    1/9/2011 11:03:00 PM
    1/10/2011 11:03:00 PM
    1/11/2011 11:03:00 PM
    1/12/2011 11:03:00 PM
    1/13/2011 11:03:00 PM
    1/16/2011 1:48:00 PM
    1/16/2011 11:03:00 PM
    1/17/2011 11:03:00 PM
    1/18/2011 11:03:00 PM
    1/19/2011 11:03:00 PM
    1/20/2011 11:03:00 PM
    1/23/2011 3:18:00 PM
    1/23/2011 11:03:00 PM

    #2
    by the way I'm using nt7

    Comment


      #3
      Hi Mike, what session template are you working with? Have you tried reloading your historical data and then reapplying the prints?

      Comment


        #4
        24/7 and yes i've reloaded historical data. shouldn't my code work regardless what template i'm using?

        Comment


          #5
          Correct, it would work for any template - but when looking into the printout times you need to keep in mind for example on a Sunday the for electronic hours would start at 6PM EST, not 12:00 like you would see for regular weekdays on the 24 hrs template.

          Comment


            #6
            understand...if you look in detail at the times i provided you will see there are days missing that aren't saturday, some days have more than one date printed, others have times printed that aren't the first bar of the day.

            Comment


              #7
              Mike, I can't reproduce it here - can you please let me know the exact setup you use in order to see the see invalid prints?

              Comment


                #8
                here's a strat that does what I described.

                here's what it prints in the output window and is based on a 5 min bar.

                1/9/2011 11:05:00 PM
                1/10/2011 11:05:00 PM
                1/11/2011 11:05:00 PM
                1/12/2011 11:05:00 PM
                1/13/2011 11:05:00 PM
                1/16/2011 1:50:00 PM
                1/16/2011 11:05:00 PM
                1/17/2011 11:05:00 PM
                1/18/2011 11:05:00 PM
                1/19/2011 11:05:00 PM
                1/20/2011 11:05:00 PM
                1/23/2011 3:20:00 PM
                1/23/2011 11:05:00 PM
                Attached Files

                Comment


                  #9
                  Thanks Mike, in which timezone are you testing, CST? Here's what I get on latest NT7 R2 -

                  1/9/2011 6:05:00 PM
                  1/10/2011 12:05:00 AM
                  1/11/2011 12:05:00 AM
                  1/12/2011 12:05:00 AM
                  1/13/2011 12:05:00 AM
                  1/14/2011 12:05:00 AM
                  1/16/2011 6:05:00 PM
                  1/17/2011 12:05:00 AM
                  1/18/2011 12:05:00 AM
                  1/19/2011 12:05:00 AM
                  1/20/2011 12:05:00 AM
                  1/21/2011 12:05:00 AM
                  1/23/2011 6:05:00 PM
                  1/24/2011 12:05:00 AM

                  Comment


                    #10
                    central

                    you are getting what i expect to see. wonder why i'm not getting that? my computer clock synchs with an atomic clock every day.

                    Comment


                      #11
                      Hmm, I would then retry with a cleared cache and brand new data downloaded from the server, it looks to me like your missing periods / ticks here, so it triggers correct on the underlying data it has...

                      Comment

                      Latest Posts

                      Collapse

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