The formula to calculate ATR for an investment with a previous ATR calculation is :
\begin{aligned}&\frac{ \text{Previous ATR} ( n – 1 ) + \text{TR} }{ n } \\&\textbf{where:} \\&n = \text{Number of periods} \\&\text{TR} = \text{True range} \\\end{aligned}nPrevious ATR(n−1)+TRwhere:n=Number of periodsTR=True range
If there is not a previous ATR calculated, you must use:
\begin{aligned}&\Big ( \frac{ 1 }{ n } \Big ) \sum_{i}^{n} \text{TR}_i \\&\textbf{where:} \\&\text{TR}_i = \text{Particular true range, such as first day’s TR,} \\&\text{then second, then third} \\&n = \text{Number of periods} \\\end{aligned}(n1)i∑nTRiwhere:TRi=Particular true range, such as first day’s TR,then second, then thirdn=Number of periods
The capital sigma symbol (Σ) represents the summation of all of the terms for n periods starting at i, or the period specified. If there is no number following i, it is assumed the starting point is the first period (you may see i=1, noting to start summing at the first term).
You must first use the following formula to calculate the true range:
\begin{aligned}&\text{ TR } = \text{ Max } [ ( \text{H} – \text{L} ), | \text{H} – \text{C}_p |, | \text{L} – \text{C}_p | ] \\&\textbf{where:} \\&\text{H} = \text{Today’s high} \\&\text{L} = \text{Today’s low} \\&\text{C}_p = \text{Yesterday’s closing price} \\&\text{Max} = \text{Highest value of the three terms} \\&\textbf{so that:} \\&( \text{H} – \text{L} ) = \text{Today’s high minus the low} \\&| \text{H} – \text{C}_p | = \text{Absolute value of today’s high minus} \\&\text{yesterday’s closing price} \\&| \text{L} – \text{C}_p | = \text{Absolute value of today’s low minus} \\&\text{yesterday’s closing price} \\\end{aligned} TR = Max [(H−L),∣H−Cp∣,∣L−Cp∣]where:H=Today’s highL=Today’s lowCp=Yesterday’s closing priceMax=Highest value of the three termsso that:(H−L)=Today’s high minus the low∣H−Cp∣=Absolute value of today’s high minusyesterday’s closing price∣L−Cp∣=Absolute value of today’s low minusyesterday’s closing price