# ATR

## ATR

**The Average True Range (ATR)** is a technical indicator of volatility based on the average of a particular set of trading ranges over a defined number of periods. The ATR is the average of the true range for a set of periods. The greatest of one of three ranges is calculated as the true range for a period: the current high minus the current low, the current high minus the previous period’s close, or the current low minus the previous close.

Once the true range is calculated, the average for a set lookback period is taken, typically 14 periods. A decline in ATR indicates a decrease in recent volatility. An increase in ATR indicates an increase in recent volatility.

The source code for the ATR function is available [here](https://app.optionalpha.com/ta/ATR.txt).

```
/* Average True Range is the greatest of the following: 
 *
 *  val1 = distance from today's high to today's low.
 *  val2 = distance from yesterday's close to today's high.
 *  val3 = distance from yesterday's close to today's low.   
 *
 * These value are averaged for the specified period using
 * Wilder method. This method has an unstable period comparable
 * to an Exponential Moving Average (EMA).
 */
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.optionalpha.com/technical-documentation/indicators/atr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
