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 habeebft, Today, 07:27 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by AveryFlynn, Today, 04:57 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Max238, Today, 01:28 AM
        4 responses
        37 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by r68cervera, Today, 05:29 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by geddyisodin, Today, 05:20 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X