Average true range (ATR) is a technical analysis volatility indicator originally developed by J. Welles Wilder, Jr.
Wilder designed ATR with commodities and daily prices in mind. Commodities tend to be more volatile than stocks. You have days which are subject to gaps and limit moves which occur when a commodity opens up or down its maximum allowed move for the session. Simple voltatility formula based on highlow range would fail to capture volatility from these moves.
The indicator does not provide an indication of price trend, simply the degree of price volatility.
The average true range is an Nday exponential moving average of the true range values. Wilder recommended a 14period smoothing.
Wilder features ATR in his 1978 book, New Concepts in Technical Trading Systems. This book also includes the Parabolic SAR, RSI and the Directional Movement Concept (ADX).
Despite being developed before the computer age, Wilder’s indicators have stood the test of time and remain extremely popular.
True Range
Wilder started with a concept called True Range (TR), which is defined as the greatest of the following:

Method 1: Current High less the current Low

Method 2: Current High less the previous Close (absolute value)

Method 3: Current Low less the previous Close (absolute value)
This gives us the formula:
true range = max[(high – low), abs(high – closeprev), abs(low – closeprev)]
The idea of ranges is that they show the commitment or enthusiasm of traders. Large or increasing ranges suggest traders prepared to continue to bid up or sell down a stock through the course of the day. Decreasing range suggests waning interest.
Absolute values are used to ensure positive numbers. After all, Wilder was interested in measuring the distance between two points, not the direction. If the current period’s high is above the prior period’s high and the low is below the prior period’s low, then the current period’s highlow range will be used as the True Range.
This is an outside day that would use Method 1 to calculate the TR. This is pretty straight forward. Methods 2 and 3 are used when there is a gap or an inside day. A gap occurs when the previous close is greater than the current high (signaling a potential gap down or limit move) or the previous close is lower than the current low (signaling a potential gap up or limit move).
Calculation
Typically, the Average True Range (ATR) is based on 14 periods and can be calculated on an intraday, daily, weekly or monthly basis. For this example, the ATR will be based on daily data. Because there must be a beginning, the first TR value is simply the High minus the Low, and the first 14day ATR is the average of the daily TR values for the last 14 days. After that, Wilder sought to smooth the data by incorporating the previous period’s ATR value.
Current ATR = [(Prior ATR x 13) + Current TR] / 14  Multiply the previous 14day ATR by 13.  Add the most recent day's TR value.  Divide the total by 14
Absolute ATR
ATR is based on the True Range, which uses absolute price changes. As such, ATR reflects volatility as absolute level.
In other words, ATR is not shown as a percentage of the current close. This means low priced stocks will have lower ATR values than high price stocks. For example, a $2030 security will have much lower ATR values than a $200300 security. Because of this, ATR values are not comparable.
Even large price movements for a single security, such as a decline from 70 to 20, can make longterm ATR comparisons impractical.
Applicability to futures contracts vs. stocks
Since true range and ATR are calculated by subtracting prices, the volatility they compute does not change when historical prices are backadjusted by adding or subtracting a constant to every price. Backadjustments are often employed when splicing together individual monthly futures contracts to form a continuous futures contract spanning a long period of time. However the standard procedures used to compute volatility of stock prices, such as the standard deviation of logarithmic price ratios, are not invariant to (addition of a constant). Thus futures traders and analysts typically use one method (ATR) to calculate volatility, while stock traders and analysts typically use another (SD of log price ratios).