# Average true range

`atr`

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 | Kind |
| --- | --- |
| atr | value |

Warm-up: period bars (14 at the defaults).

Repaints: No.

## 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.
