Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Session Break for first session?

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

    Session Break for first session?

    Hello,

    SessionBreak and FirstBarOfSession don't seem to get set for the first session? If I run this code below, for most contracts (6A, NKD etc) and put in a session of 17:00 to 17:05, for three days, you get no first bar or session break on the first day.

    What am I missing?
    thanks
    Dave

    protected override void OnBarUpdate()
    {
    if (Bars.FirstBarOfSession) {
    Print("First Bar");
    }
    if (Bars.SessionBreak) {
    Print("Session Break");
    }

    Print("here");

    }

    #2
    Dave, thanks - can't reproduce here on my end - which chart interval are you using when you see this?

    Comment


      #3
      Hi,

      1 min chart, NKD 12-09, start 6 sep end 8 sep, start session 17:00, end session 17:10

      thanks
      Dave

      Comment


        #4
        Dave, this produces an empty chart with no bars so the behavior would be expected.

        Comment


          #5
          Hi Bertrand,

          Thanks for the reply. You need to check your chart, there is definitely data. See attached chart. In any case, I wouldn't have been able to spot that there was no session break on the first day if there'd been no data.

          In any case, this is a strategy problem. I suspect that this will occur for any instrument. I just checked and it does. FirstBar works but sessionbreak doesn't.

          Does the manual page for session break need to change to say it isn't set for the first session in a run?

          Dave
          Attached Files

          Comment


            #6
            Thanks Dave, could finally see the behavior you see and it's expected for the first session break, since there's no session to record a break from at the start of your chart. You could use FirstBarOfSession in combo with FirstTickOfBar for this.

            Comment


              #7
              Thanks, yes I figured that out. It may be worth clarifying on the web pages since it's not really obvious.

              Comment


                #8
                Ok, I see - thanks for the input Dave.

                Comment

                Latest Posts

                Collapse

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