What im looking to do is, if low is above Pivot for a user definable number of bars, do something.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Lows great then an indicator
Collapse
X
-
Lows great then an indicator
What would be an effective way of checking if Bar Lows are above a Pivot (or other indicator) for x number of bars. Would countif do it, the problem then would be how would i define the look back period.
What im looking to do is, if low is above Pivot for a user definable number of bars, do something.Tags: None
-
GKhonheiser,
You can create a User Defined Input variable for the look back period that you can change when you are setting the scripts' parameters in the chart.
Below is a reference sample of to create User Defined Input parameters -
http://www.ninjatrader.com/support/f...ead.php?t=5782Cal H.NinjaTrader Customer Service
-
Hi Cal,
I am familiar with creating the user definable input. Its the logic that is the issue. If i wanted to have two Lows above the the pivot I would need if(Low[0] > pp && Low[1] > pp), if I wanted 3 lows higher then i would have if(Low[0] > pp && Low[1] > pp && Low[2] > pp), but im looking for a more effective way of checking for this. ie If the user input is 5 then check that the last 5 lows are above PP?
Does that make sense?
Thanks
Comment
-
GKonheiser,
You can create a for loop that you can then use to test your calculation out against the user defined input.
Example -
Let me know if this helpsCode:int x = 10; // user defined input for( int i = 0; i < x; i++) { if(Low[i] > pp) { //do something } else break; }Cal H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
157 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
91 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
143 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
131 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