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 Hwop38, 05-04-2026, 07:02 PM
|
0 responses
152 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
305 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
244 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
345 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
176 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment