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