Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SessionBreak- how to work with

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

    SessionBreak- how to work with

    Hello,

    I have added in my autoscripts "if(Bars.SessionBreak == true) {then reset variables}

    But to my surprise the variables persists in the reset status then. Even when a condition is true to change value of a variable is persists with "0" and "false"

    What am I doing wrong or how has to be used SessionBreak correctly?

    Thank you
    Tony

    #2
    Hello,

    Thank you for the question.

    I could not really say what may be happening with what has been posted.

    Are you certain the reset is happening before the variables need to be used again?

    For this, I could only suggest to create a new empty script and migrate only the if(Bars.SessionBreak == true) logic into that new script to see what may be happening. If you could isolate a sample like this and provide it, I could certainly be of more help.

    I look forward to being of further assistance.

    Comment


      #3
      Hello Jesse,

      thank you for your reply. I only can say that when I comment or remove the condition I posted the variables are working OK. My intention was to reset all variables with a new session. And I thought this will work with if Bars.SessionBreak== true.

      I will find another way to do.

      Thank you
      Tony

      Comment


        #4
        When I work with data that I want to be reset at the beginning of a session, I use something like:
        Code:
        if(Bars.FirstBarOfSession)
        {
          //Reset things here
        
        }
        On occassion I also use the other side when I want to collect values at the end of the session by inserting this near the end of my onBarUpdate loop:
        Code:
        if(Bars.LastBarOfSession)
        {
          //Do something with my collected values
        }
        I am unsure if the Bars.LastBarOfSession is recommended to use? But I have used it for years w/o any problems that I am aware of.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        68 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        38 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X