Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to tell program to "go to line .."?
Collapse
X
-
Hi StemOriginally posted by Stem1 View PostHi, after some conditions are met I would like to tell the strategy to go to the end and skip everything in between. How do I code this?
Thanks
The approach I can think of is this:
Say you have 3 conditions, A, B, C as the ones, which, if met, would terminate the analysis of the current bar. In OnBarUpdate, make these your first set of conditions as follows:
The 'else' ensures that the rest of the code is not acted on if the conditions A,B & C are met.Code:if(A && B && C) { Actions... // if there are actions to take before the jump to the end [COLOR=Blue][B]return[/B][/COLOR]; } [COLOR=Blue][B]else ...[/B][/COLOR]
This is similar to when to put:
telling NT that if there aren't enough bars for the indicator(s) to work on, then 'return', i.e. terminate the analysis for that bar.Code:if (CurrentBar < Period) return;
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
581 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
338 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment