Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reset 'return' on the next day's open

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

    Reset 'return' on the next day's open

    Hi.

    I created a simple condition

    if ( profittarget >=500)
    return;

    this should stop trading if profit target for the day is above or equal to 500.

    While backtesting, I reached this profit target of 500 on day 1 of my historical data, so it completely stopped backtesting data of next days...

    Hence I felt the need to reset this 'return' at the start of next day's electronic market open. I'm talking about Crude Oil futures. Please inform how to do that.

    #2
    Hello karthik007,

    Thank you for your post.

    Use Bars.FirstBarOfSession before the profittarget check to return. For example:
    Code:
    if(Bars.FirstBarOfSession)
    profittarget = 0;
    
    if(profittarget >= 500)
    return;
    For information on Bars please visit the following link: http://www.ninjatrader.com/support/h...s/nt7/bars.htm

    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    636 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    568 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    571 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X