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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
651 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment