Average true range
The average true range over a period, Wilder smoothed or simple.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| period | int | 14 | 1 to 5000 |
| method | choice | wilder |
Outputs
| Name | Type | Required | Description |
|---|---|---|---|
| atr | value | Optional | color theme.accent, style line, width 1 |
- Warm-up
- period bars (14 at the defaults)
- Repaints
- No
- Parity
- TA-Lib, within 1e-9
Formula
TR[i] = max(high[i], close[i-1]) - min(low[i], close[i-1])
wilder: the first value is the mean of the first period true ranges, then ATR[i] = (ATR[i-1] * (period - 1) + TR[i]) / period
sma: the mean of the last period true ranges
No value until period true ranges exist.