Thanks for any help.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Number of bars after crossabove
Collapse
X
-
Number of bars after crossabove
Hi. I have been trying all sorts of different things to get an order to enter after a crossabove but I want it to not enter until after the bar after the crossabove has been completed and meets a condition and if it doesn't meet the condition on that bar then the strategy is reset. So basically I want the order to enter two bars from the crossabove . I have tried creating private int but still can't get it to work. Is there a way to have the crossabove condition trigger the start of the condition and then wait 1 bar to see if the condition still exist before entering an order? Maybe some sort of crossabove=currentbar then somewhere in the condition it says currentbar + 1. Some sort of way to count the bars since crossabove. I hope I am being clear if not let me know.
Thanks for any help.Tags: None
-
Hllo,
There is a lookback period build into CrossAbove(). If you want to ensure that the condition was only true in the last 2 bars, you would use a value of 2.
if (CrossAbove(RSI(14), 80, 2))
If thats not what you're looking for, I would suggest reviewing our Reference Sample on Referencing the Correct Bar:
MatthewNinjaTrader Product Management
-
Hi cre8it8,
It sounds like you may want to define sequences, where one condition is evaluated after another. There is a good reference sample here that can help with sequences. It uses UserVariables for this, and the entire strategy is built with the strategy wizard. Import it and then edit to see how the sequences are setup.
Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
646 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
367 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 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
570 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment