Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MAX of an indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Thank you! Thank you! s.kinra saves the day. The workaround works beautifully! Thanks again!

    Comment


      #17
      So now you should be sure your calculation for bars since entry is evaluating to 0 at some point, so I just skipped it. I talked about it earlier but you missed it then. Anyways good going & print the values to be sure.

      Comment


        #18
        Yep you nailed it. Sorry I missed it. My bars since entry calculation equals 0 on the bar the trade is entered, it never dawned on me! Thanks again!

        Comment


          #19
          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:

          Code:
          MAX(ATR(50), 10);
          But I can't seem to find the right way to pass the below through the MAX() function and make it compile:

          Code:
          OrderFlowCumulativeDelta(BarsArray[1], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaHigh[0]
          Thanks in advance for any response!

          Comment


            #20
            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


              #21
              Thanks Paul! You rock.

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