The percentile rank of a score is the percentage of scores in its frequency distribution that are equal to or lower than it. For example, a test score that is greater than or equal to 75% of the scores of people taking the test is said to be at the 75th percentile, where 75 is the percentile rank. (source Wikipedia).
This indicator gives the percentile rank of the current Average True Range compared to the 200 periods previous ones. By comparing the recent ATR to the previous behaviour of it on the same instrument, we can have a clearer view of what the current volatility means because of its ranking in percentage. This kind of sorting formula could be adapted to any other values.
ATRPctRkLookback = 200
ATRperiod = 20
rnkCount = 0
ATR = averagetruerange[ATRperiod](close)
FOR i = 1 TO ATRPctRkLookback DO
IF ATR > ATR[i] THEN
rnkCount = rnkCount + 1
endif
NEXT
ATRPctRank = 100 * rnkCount / ATRPctRkLookback
RETURN ATRPctRank
No files found.