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 argusthome, Yesterday, 10:06 AM
                0 responses
                18 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                17 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                14 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                9 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                38 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X