atr
forge.tafunctionSince Forge API 1
Functionpython
forge.ta.atr(high: ArrayLike,low: ArrayLike,close: ArrayLike,period: int = 14,method: str = 'wilder') -> np.ndarrayAverage true range, Wilder smoothed (wilder) or a simple mean (sma).
Parameters
| Name | Type | Default |
|---|---|---|
| high | ArrayLike | |
| low | ArrayLike | |
| close | ArrayLike | |
| period | int | 14 |
| method | str | 'wilder' |
Both start from the true range of bar 1, so the first value is on bar period. After a
missing bar the average restarts with a fresh warm-up.
Classpython
forge.ta.ATR(**inputs: Any) -> NoneThe average true range over a period, Wilder smoothed or simple.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| period | int | 14 | 1 to 5000 |
| method | choice | wilder |
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.