The Average True Range (ATR) is a technical indicator used to measure market volatility. It was introduced by J. Welles Wilder Jr. in his book “New Concepts in Technical Trading Systems.” The ATR indicator does not indicate price direction, but rather the degree of price movement or volatility within a given period of time.
AverageTrueRange[N](price)
This function takes two parameters:
The ATR is calculated by first determining the True Range (TR), which is the greatest of the following:
Once the True Range is determined for each period, a Wilder’s moving average (specifically designed for the ATR) is applied to these values over ‘N’ periods to compute the Average True Range.
ATR = AverageTrueRange[14](close)
RETURN ATR coloured(100,0,0)
This example calculates the 14-period ATR based on the closing prices and colors the output in red (RGB: 100, 0, 0).
The ATR is particularly useful in trading systems to adjust levels of stop-loss orders or to determine entry and exit points based on levels of volatility. An increasing ATR indicates rising volatility, while a decreasing ATR suggests declining volatility. The ATR, however, does not provide any information regarding price direction or duration, only the volatility level.