Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Understanding the MAX function

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

    Understanding the MAX function

    Hello there

    This probably sounds a silly question, but I'm looking at this line of code within the parabolic indicator script:

    Value.Set(xp + (longPosition ? -1 : 1) * ((MAX(High, CurrentBar)[0] - MIN(Low, CurrentBar)[0]) * af));


    so my queary is.. doesn't this

    MAX(High, CurrentBar)[0] just mean High;

    and this

    MIN(Low, CurrentBar)[0]) just mean low:

    Thanks in advance....... Andy

    #2
    MAX(High, CurrentBar)[0] means the maximum of the high values of the last "CurrentBar" bars (equivalent for MIN(Low, CurrentBar)[0]))


    Comment


      #3
      Thank you for the quick response, but I'm a little confused, doesn't currentbar mean the actual currentbar in progress?


      Here's the section of code it's from

      if (CurrentBar < 3)
      return;
      else if (CurrentBar == 3)
      {
      // Determine initial position
      longPosition = High[0] > High[1] ? true : false;
      xp = MAX(longPosition ? High : Low, CurrentBar)[0];
      af = Acceleration;
      Value.Set(xp + (longPosition ? -1 : 1) * ((MAX(High, CurrentBar)[0] - MIN(Low, CurrentBar)[0]) * af));
      return;


      Thanks

      Andy

      Comment


        #4
        Right, thus code below calculates the max of the highs of all bars seen so far.

        Comment


          #5
          Thank you again for the lightening quick response, just so I can get my head around it. It's basically saying the highest high of the first 3 bars on the chart to get the indicator underway... is this correct?

          Thanks

          Andy

          Comment


            #6
            I have not read the thread but...

            MAX(High, 3)[0]

            would return the highest high value of the last three bars.
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            152 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            87 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            131 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            127 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            106 views
            0 likes
            Last Post CarlTrading  
            Working...
            X