Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ranking Indicator Values

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

    #16
    Well, I wouldn't actually be doing a percentile ranking of a percentile ranking. It would be more like a percentile ranking of the average value of 3 indicators, and one of those 3 indicators is a percentile ranking of the daily changes.

    I do this manually in Excel on daily data right now and I have compared these doubly-ranked values against just using the arithmetic average of the 3 indicators and they are similar, but definitely not identical.

    Comment


      #17
      Originally posted by PhillyD View Post
      Well, I wouldn't actually be doing a percentile ranking of a percentile ranking. It would be more like a percentile ranking of the average value of 3 indicators, and one of those 3 indicators is a percentile ranking of the daily changes.

      I do this manually in Excel on daily data right now and I have compared these doubly-ranked values against just using the arithmetic average of the 3 indicators and they are similar, but definitely not identical.
      In that case you would need to define a new DataSeries in the Variables section of the indicator, intialize the DataSeries in the Initialize() section of the indicator and apply the following logic in OnBarUpdate():

      -> first run the percentile ranking algorithm on your input series
      -> then calculate the arithmetic mean of the 3 indicators and write the result to the newly created DataSereis
      -> finally apply the percentile ranking algorithm to the new DataSeries

      Percentile ranking is an interesting way of normalizing an indicator over a number N of given bars. Alternatively you could use the Z-score for doing the normlization.

      Comment


        #18
        Originally posted by anachronist View Post
        If you still need this, I have just uploaded a Percentile indicator to the NT7 file sharing area. You can use it to plot median values of the last N bars, or any percentile of the last N bars. It's an efficient, fast algorithm, too.
        @anachronist, the part of your indicator getPercentile(), does it return a percentile if passed an array of values? I have a need for this as I want to calculate percentiles based on portions of an array.

        Comment


          #19
          Originally posted by forrestang View Post
          @anachronist, the part of your indicator getPercentile(), does it return a percentile if passed an array of values? I have a need for this as I want to calculate percentiles based on portions of an array.
          No, getPercentile() takes only the desired percentile (0 to 100) as an argument. You cannot pass an array of values to it. Internally the indicator maintains a sorted list of the last N values in a data series. Most of the code in the getPercentile() function just calculates the array index corresponding to the desired percentile and, because this is almost never a whole number, it interpolates between the values in the nearest array indices to return a result.

          If you want the percentile of an array, it's simple. Just sort the array and calculate the array index closest to your desired percentile. The value at the nearest array index will be the percentile. If you want to get fancy, you can interpolate like my indicator does.

          Comment


            #20
            thanks for the snippet, Harry. I've been trying to get a percentile working for weeks

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            607 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            353 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            561 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X