Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

code to move to next day

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

    code to move to next day

    how do you get the onbarupdate to move on to next day if certain condition is not met

    i thought i could use the return; command but this seems to end the entire code.
    i just want it to wait till next day to check condition again

    #2
    Hello fiddy,

    Thank you for writing in. You could use something like the following:
    Code:
    private bool canRun = true;
    protected override void OnBarUpdate()
    {
        if(Bars.FirstBarOfSession)
            canRun = true;
        if(yourConditionIsMet)
            canRun = false;
        if(!canRun)
            return;
    
        //Rest of code below this line:
        //-----------------------------------------
    }
    More information can be found in our help guide here: http://ninjatrader.com/support/helpG...ghtsub=session

    Please let me know if you have any questions.
    Michael M.NinjaTrader Quality Assurance

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mongo, Today, 11:05 AM
    2 responses
    7 views
    0 likes
    Last Post Mongo
    by Mongo
     
    Started by guillembm, Today, 11:25 AM
    0 responses
    3 views
    0 likes
    Last Post guillembm  
    Started by Tim-c, Today, 10:58 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by traderqz, Yesterday, 09:06 AM
    4 responses
    27 views
    0 likes
    Last Post traderqz  
    Started by traderqz, Today, 12:06 AM
    4 responses
    8 views
    0 likes
    Last Post traderqz  
    Working...
    X