ta.atr
Size the typical bar to bar movement, for stops and position sizing.
ta.atr(length, bars)Average True Range of bars: Wilder's smoothing of ta.tr(). ta.atr(14, d) with d = series(timeframe="1d") is a daily average true range on any chart.
Parameters
A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.
| Name | Kind | Type | Unit | Default | Range | Description |
|---|---|---|---|---|---|---|
length | Constant | number | - | 14 | 1 to 10000 | Window in observed bars. |
bars | Constant | bars | bars | na | - | Which bars to read: a declared series, or na for the chart's own. |
Output
| Name | Type | Unit |
|---|---|---|
value | number | - |
Warm-up and missing values
- Warm-up
lengthbars. Names in the warm-up are this operator’s parameters.- Missing values
- Returns na until
lengthconsecutive non-na observations are in the window. An na resets the accumulation.
Example
ta.atr(14)plot(ta.atr(14), "Average range 14")