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 gravdigaz6, Yesterday, 11:40 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by MarianApalaghiei, Yesterday, 10:49 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by XXtrader, Yesterday, 11:30 PM
        0 responses
        4 views
        0 likes
        Last Post XXtrader  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Yesterday, 09:43 PM
        0 responses
        9 views
        0 likes
        Last Post funk10101  
        Working...
        X