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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            161 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            311 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            245 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            350 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            179 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X