Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
MAX of an indicator
Collapse
X
-
Happy Holidays All! Could someone please advise how to use the aforementioned syntax with NT8 indicator OrderFlowCumulativeDelta while using the BarsArray functionality, too?
Example: Lets say within a strategy set to OnBarUpdate I want to find if the current bar "[0]" is the "bar with the highest session delta over the last 10 bars," and I'm doing this across multiple timeframes (i.e. BarsArray[1], BarsArray[2], etc.)
If I were using the ATR indicator instead of OrderFlowCumulativeDelta, I completely understand this:
But I can't seem to find the right way to pass the below through the MAX() function and make it compile:Code:MAX(ATR(50), 10);
Thanks in advance for any response!Code:OrderFlowCumulativeDelta(BarsArray[1], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaHigh[0]
Comment
-
Hello jeh007258,
Thanks for your post and welcome to the NinjaTrader forums!
The MAX() requires a series as its input and also requires a bars ago as a starting point.
Reference: https://ninjatrader.com/support/help...aximum_max.htm
I think what you want is:
if (OrderFlowCumulativeDelta(BarsArray[1], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaHigh[0] > MAX(OrderFlowCumulativeDelta(BarsArray[1], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaHigh, 10)[1])
{
// do something
}
Note that I used MAX(....)[1] so that it pulls the max value from the 10 previous bars and then the if statement compares that to the current bar value[0] of the cumulative delta.
NOTE: I would suggest looking at calling the OrderFlowVWAP by reference instead of creating new copies on each call. Please check the second example here: https://ninjatrader.com/support/help...ive_delta2.htm That way you do not need to write as much and can eliminate the parameters. Using the example in your case your code would look more like:
if (cumulativeDelta.DeltaHigh[0] > MAX(cumulativeDelta.DeltaHigh, 10)[1])
{
// do something
}
which is much easier to read and less prone to errors.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
54 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
72 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
38 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
99 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
60 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment