Investment Studio > Expressions > Functions > Indicator > ATR
float array[*][2] atr(float array[*][4] dhlc, integer days = 14)
Returns a two-column array containing dates (first column) and corresponding Average True Range (ATR) values (second column). Given n input rows in dhlc, n - 1 rows are returned.
dhlc is a four-column array containing daily price quotes. Each row is structured as follows:
| Column # | Content |
| 1 | The quote date. |
| 2 | The day's high (highest traded price). |
| 3 | The day's low (lowest traded price). |
| 4 | The day's close (last traded price). |
The array is assumed to be time-sorted, with earlier dates preceding later dates.
Automatic type conversion allows the use of date strings as arguments instead of explicit date values.
days is the length of the time window under consideration, i.e. the number of trading days contributing to the computation of each day's ATR. If omitted, it defaults to 14.
Interpretation
ATR is a measure of volatility. It's defined as the arithmetic average of the True Range (TR) over the specified number of days and is therefore equivalent to (but more efficient than) the expression
=ma(tr(dhlc), days)
As a rule of thumb, volatility tends to rise when prices are declining (a sign of increasing nervousness), peaking at major market bottoms; it tends to fall as prices climb steadily in mature bull markets (a sign of complacency, "good times are here to stay") but can rise sharply as major market tops break down.
For a real life example, consider IBM (NYSE:IBM) from June 1 to December 31, 2001:

The top chart shows daily prices in standard candlestick form, the bottom chart shows their 14 day ATR (compare it with the corresponding VOI chart).
While this example is suggestive, it's also easy to find exceptions to the rule. In general, volatility should be viewed primarily as supporting rather than as conclusive evidence of new market developments.
Example
Assuming standard US date format settings,
=atr({{"1/1/1990", 100, 90, 98}, {"1/2/1990", 97, 84, 86}, {"1/3/1990", 95, 89, 91}}, 2)
returns {{32876, 11}}. 32876 is the date code for 1/3/1990; 11 is the 2 day ATR value for that date. You can easily verify that TR of the same argument array is {{32875, 13}, {32876, 9}}; and of course (13 + 9) / 2 = 11.