Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
High of Last 10 bars at least 30 Ticks Above Indicator
Collapse
X
-
Hi GLockwood,
Thank you for your post and welcome to the forums!
You will need to create a for loop that will test when the High price is equal to the MAX(High, 10)[1].
Example -
Additionally, I would take a look at the link below on other ways to reference the correct barCode:if(CurrentBar < 10) return; int highValue = 0; for( int i = 0; i < 10; i++) { if(High[i] != MAX(High, 10)[1]) { highValue++; } if(High[i] == MAX(High, 10)[1]) { Print(" "); Print(highValue + ToTime(Time[0])); break; } }
Referencing the Correct Bar
Let me know if I can be of further assistance.Cal H.NinjaTrader Customer Service
-
Lol, having issues with the forum buttons and I keep getting logged out.
Anyway, I have one more question. How do I reference methods like Close[0] and High[0] from outside the OnBarUpdate method. I'm trying to reference them from another method in the same class and getting the CS0120 error.
"An object reference is required for the non-static field, method, or property 'NinjaTrader.Strategy.StrategyBase.High.get'"
Comment
-
Lol, having problems with the forum.
Anyway, I have one more question. I'm trying to reference High[1] and Close[0] from outside of the OnBarUpdate method in my own
public static bool EntryLongCheck()
method within the strategy class and getting the CS0120 error:
"An object reference is required for the non-static field, method, or reference 'NinjaTrader.Strategy.StrategyBase.High.get'"
Thanks again!
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
56 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
143 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
160 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
96 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
276 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment