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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
152 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
89 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
131 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
127 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment