Category
Multi-Bar Functions
Description
Percent rank among values
Syntax
PercentRank(expr, count)
Parameters
expr - data series formula
count - lookback period
Notes
expr is calculated for each bar, then results are sorted (ranked) from highest to lowest.
The highest value is given a Rank of 1, the next highest 2, and so on.
PercentRank is calculated as: 100 / (count-1) * (count-rank), or simply 100 if count is 1.
For the highest value, this will always be 100.
For the lowest value, this will always be 0 (unless there is only one value).
For three values, PercentRank will always be 0, 50, or 100.
For four values, PercentRank will always be 0, 33.33, 66.66, or 100.
etc.
This implementation of PercentRank is identical to the function of the same name in Microsoft Excel.
For AmiBroker users, please note that their PercentRank function adds one to count, so if you're trying to exactly match their PercentRank(expr, count) for the same set of data, use PercentRank(expr, count + 1).
|