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 kinfxhk, 07-14-2026, 09:39 AM
|
0 responses
127 views
0 likes
|
Last Post
by kinfxhk
07-14-2026, 09:39 AM
|
||
|
Started by kinfxhk, 07-13-2026, 10:18 AM
|
0 responses
105 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 10:18 AM
|
||
|
Started by kinfxhk, 07-13-2026, 09:50 AM
|
0 responses
85 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 09:50 AM
|
||
|
Started by kinfxhk, 07-13-2026, 07:21 AM
|
0 responses
105 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 07:21 AM
|
||
|
Started by kinfxhk, 07-11-2026, 02:11 AM
|
0 responses
86 views
0 likes
|
Last Post
by kinfxhk
07-11-2026, 02:11 AM
|

Comment