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 MacDad, 02-25-2024, 11:48 PM
    8 responses
    171 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by alancurry, Today, 06:53 AM
    0 responses
    3 views
    0 likes
    Last Post alancurry  
    Started by Juanhuisman, Today, 06:51 AM
    0 responses
    2 views
    0 likes
    Last Post Juanhuisman  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    173 responses
    2,338 views
    0 likes
    Last Post intelligenttrader  
    Started by ArkansasClint, 04-25-2024, 09:28 AM
    1 response
    23 views
    0 likes
    Last Post Leafcutter  
    Working...
    X