Technical indicator “Average True Range”, also usually named as “ATR”
Syntax:
1 |
AverageTrueRange[N](price) |
Calculation :
This represents the volatility of a stock.
True range is the highest data in absolute value among :
(today’s high – today’s low)
(today’s high – yesterday’s close)
(today’s low – yesterday’s close)
To calculate the Average True Range, it is necessary to apply a Wilder moving average of the True Range.
Interpretation :
This indicator of volatility measures selling pressure and buying pressure. When the ATR rises there is more and more and more pressure and a strong volatility of the stock.
When the ATR decreases there is less and less pressure and a low volatility.
Example:
1 2 3 |
ATR = AverageTrueRange[14](Close) RETURN ATR coloured(100,0,0) |
I do not understand the calculation …AverageTrueRange[14](Close)?? I understand what true range is, and that you will smooth it with a wilder average, for 14 periods, but what is the input, (close), how is it integrated into the calculation?
(close) refer to the previous bar Close.
i do not understand the calculation too.
in particular i have created an indicator that works as mentioned this way: TrueRange = max(high-low, max(abs(high-close[1]), abs(low-close[1]))) and then AverTrueRange = Average[periods](TrueRange)…
i felt surprised finding out a different curve than the default one, what does differ in AverageTrueRange from the description is posted above and in other forums?
so, (Close) you said refers to the previous bar close… that means if i change from close to another buffer the calculation changes by taking the previous value of the array passed?
Hi @AlienFriday, the answer is almost yours with a little difference:
the code was not displayed in my previous comment, so I repost it
A = high – low
B = ABS(high – close[1])
C = ABS(low – close[1])
trueRange = MAX(A,MAX(B,C)) // we cannot do MAX(A,B,C)
RETURN WilderAverage[14](trueRange)
The code is clear but i still dont understand the CLOSE at the end. where is it used? ATR refers to 3 standard elements: today’s high – today’s low – yesterday’s close
//I use this code to offset the averagetruerange because Close[0] is not used. Only High[0], Low[0] and Close[1] are used.
i=0
A = high[i] – low[i]
B = ABS(high[i] – close[i+1])
C = ABS(low[i] – close[i+1])
trueRange = MAX(A,MAX(B,C)) // we cannot do MAX(A,B,C)
RETURN WilderAverage[14](trueRange)