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.
    JesseNinjaTrader Customer Service

    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 burtoninlondon, Today, 12:38 AM
        0 responses
        5 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        14 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        13 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,983 views
        3 likes
        Last Post jhudas88  
        Working...
        X