Average True Range (ATR)
Contents
Average True Range is a technical analysis indicator that measures the price change volatility. It was developed by J. Welles Wilder Jr. for commodity market analysis. The indicator says nothing about trend strength or direction; instead it just shows the volatility level.
Calculation
True Range
Before proceeding to average true range calculation, it is necessary to calculate true range. True range is calculated using the following formula:
TR = max(High_{t} − Low_{t}, abs(High_{t} − Close_{t − 1}), abs(Low_{t} − Close_{t − 1}))
Where TR — true range for the period t,
High_{t} — price High for the period t,
Low_{t} — price Low for the period t,
Close_{t − 1} — price Close for the period (t − 1),
max() — maximum value selection function,
abs() — absolute value calculation function.
The formula is translated into:
TR = max(High_{t}, Close_{t − 1}) − min(Low_{t}, Close_{t − 1}).
Where min() — minimum value selection function.
Average value
Average true range for a given number of periods can be calculated after calculating the true range values for all those periods. The popular number of periods for ATR is 7 (proposed by the indicator's author in his book New Concepts in Technical Trading Systems) and 14 (used, for example, in MetaTrader default settings).
The principle of exponential moving average calculation is applied:
ATR_{t}  =  ATR_{t − 1} × (n − 1) + TR_{t} 
——————  
n 
Where ATR_{t} — average true range for the period t,
ATR_{t − 1} — average true range for the previous period (t − 1),
TR_{t} — true range for the period t,
n — number of periods for averaging.
The first average true range value is calculated using this formula:
ATR_{n} 
= 


——————  
n 
Where ATR_{n} — average true range for the period n — the first period, for which all the n true range values are present,
TR_{i} — true range for the period i.
Examples
7 periods
The first example shows a complete calculation process for the 7day average true range on the EUR/USD currency pair. 8 price quotes is enough to calculate 2 ATR values. The price Close values are used with the negative shift of 1 period because only shifted values are used in the TR formula:
i  Close  High  Low 

0  1.2919     
1  1.2884  1.2942  1.2842 
2  1.2881  1.2929  1.2846 
3  1.2836  1.2889  1.2796 
4  1.2881  1.2900  1.2819 
5  1.2905  1.2933  1.2840 
6  1.2857  1.2997  1.2833 
7  1.2932  1.2956  1.2821 
8    1.2993  1.2904 
True range calculation:
TR_{1} = max(1.2942, 1.2919) − min(1.2842, 1.2919) = 1.2942 − 1.2842 = 0.0100;
TR_{2} = 1.2929 − 1.2846 = 0.0083;
TR_{3} = 0.0093;
TR_{4} = 0.0081;
TR_{5} = 0.0093;
TR_{6} = 0.0164;
TR_{7} = 0.0135;
TR_{8} = 0.0089.
The first average true range is calculated using simple arithmetic average formula:
ATR_{7}  =  0.0100 + 0.0083 + 0.0093 + 0.0081 + 0.0093 + 0.0164 + 0.0135  =  0.0107 
——————  
7 
The next average true range should be calculated using moving average formula:
ATR_{8}  =  ATR_{7} × 6 + TR_{8}  =  0.0107 × 6 + 0.0089  =  0.0104 
——————  ——————  
7  7 
14 periods
The second example shows calculation process for the 14day average true range of the EUR/USD currency pair's quotes. 2 ATR values will be calculated, so a total of 15 Close/High/Low quotes are required. Close prices are taken with a negative shift of one period as the TR formula uses them with t − 1 index:
i  Close  High  Low 

0  1.3111     
1  1.3075  1.3140  1.3053 
2  1.3078  1.3131  1.3067 
3  1.3151  1.3194  1.3071 
4  1.3041  1.3176  1.3009 
5  1.2935  1.3050  1.2935 
6  1.2974  1.2999  1.2941 
7  1.2919  1.3029  1.2912 
8  1.2884  1.2942  1.2842 
9  1.2881  1.2929  1.2846 
10  1.2836  1.2889  1.2796 
11  1.2881  1.2900  1.2819 
12  1.2905  1.2933  1.2840 
13  1.2857  1.2997  1.2833 
14  1.2932  1.2956  1.2821 
15    1.2993  1.2904 
True range calculation:
TR_{1} = max(1.3140, 1.3111) − min(1.3053, 1.3111) = 1.3140 − 1.3053 = 0.0087;
TR_{2} = 1.3131 − 1.3067 = 0.0064;
TR_{3} = 0.0123;
TR_{4} = 0.0167;
TR_{5} = 0.0115;
TR_{6} = 0.0064;
TR_{7} = 0.0117;
TR_{8} = 0.0100;
TR_{9} = 0.0083;
TR_{10} = 0.0093;
TR_{11} = 0.0081;
TR_{12} = 0.0093;
TR_{13} = 0.0164;
TR_{14} = 0.0135;
TR_{15} = 0.0089.
The first average true range is calculated using simple arithmetic average formula:
ATR_{14}  =  0.1484  =  0.0106 
——————  
14 
The next average true range should be calculated using moving average formula:
ATR_{15}  =  ATR_{14} × 13 + TR_{15}  =  0.0106 × 13 + 0.0089  =  0.0105 
——————  ——————  
14  14 
Chart
The following chart displays the average true range (cyan line below) for the EUR/USD price (shown above). Standard Average True Range indicator from the MetaTrader 5 trading platform with period set to 14 is used for calculation.
Application
As the indicator's mathematical formula suggests, average true range cannot be used for trading signals on its own. ATR is showing neither trend's strength nor its direction. A trader can apply it as a price volatility gauge and then use this information in trading:
 Some trading strategies require high (scalping, grid) or low (trend trading) volatility. Average true range can help measuring it, both in automatic and in manual modes. It is important to remember that indicator's values are relative but absolute and thus should be compared to the values derived from the same trading instrument and not to some specific fixed threshold.
 ATR can be used as a stoploss value because price deviation for a number of pips greater than time period's average range is definitely a significant change in price's behavior. For example, such a stoploss can be used for intraday trading, while ATR is calculated on daily chart. ATR Trailer expert advisor is based on ATR as its trailing stoploss.
 ATR can also be used as a potential stoploss in trading systems. It is applied in position sizing for strategies that do not set stoploss order. In this case, the potential loss size is limited by the current market volatility.
Dependence on Period
Traders should understand that the average true range values is not increasing directly with the increasing period number (e.g. from 7 to 14). Raising the number of periods for calculation leads to better smoothing of the indicator (noise removal) and to increased lag — i.e. time between the actual volatility change and the indicator value change).
At the same time, changing the period itself (timeframe) can lead to a significant change in the calculated indicator value as the price change range is dependent on the length of this range (e.g. one day or one week).
Sources
 J. Welles Wilder, Jr. New Concepts in Technical Trading Systems. ISBN 0894590278
 http://codebase.mql4.com/250
 http://www.mql5.com/en/code/12
 http://ctdn.com/algos/indicators/show/221