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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
581 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
338 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment