> For the complete documentation index, see [llms.txt](https://docs.atraderlife.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.atraderlife.com/courses/excel-tips/calculate-atr.md).

# How to calculate ATR

The Average True Range (ATR) of an asset is a historical volatility indicator that calculates the average of a number of previous True Range values. The True Range (TR) of an asset can be defined as follows:<br>

ATRx = (TRt + … + TRt-x) / Opent-x

Where: ATRx – Rolling x-day Average True Range\
TRt – True Range in period t\
Opent – Open price in period t

\
The ATR and TR values allow us to understand historical volatilities; and when we compare these values across various periods we can gauge how volatility of an asset has changed with time. By understanding ATR as a historical volatility indicator we can use is to appreciate the trading opportunities inherit in the asset and the risk that come with it.\
In this example we calculate rolling one day ATRs for the S\&P500, and compare averages of these rolling ATRs over different periods in time.&#x20;

![](/files/-MbCjcOgetzi8tM7Xrq-)

{% file src="/files/-MbCjiQ1\_BhPex2rd0JR" %}
Download - ATR SP500
{% endfile %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.atraderlife.com/courses/excel-tips/calculate-atr.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
