ATR percentile rank

Category: Indicators By: Nicolas Created: May 19, 2016, 4:46 PM
May 19, 2016, 4:46 PM
Indicators
6 Comments

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.

Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Logo Logo
Loading...