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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
81 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
64 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
68 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
55 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment