supertrend
forge.tafunctionSince Forge API 1
Functionpython
forge.ta.supertrend(high: ArrayLike,low: ArrayLike,close: ArrayLike,atr_period: int = 10,factor: float = 3.0) -> dict[str, np.ndarray]SuperTrend: a line factor average true ranges from the bar's midpoint that only ratchets.
Parameters
| Name | Type | Default |
|---|---|---|
| high | ArrayLike | |
| low | ArrayLike | |
| close | ArrayLike | |
| atr_period | int | 10 |
| factor | float | 3.0 |
direction is +1 while price is above the line and -1 while below (the negative of
TradingView's). The average true range is Wilder's. NaN until it is defined.
Classpython
forge.ta.SuperTrend(**inputs: Any) -> NoneTrend-following line built from the average true range.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| atr_period | int | 10 | 1 to 500 |
| factor | float | 3 | 0.1 to 20 |
upper = (high + low) / 2 + factor * ATR, lower = (high + low) / 2 - factor * ATR
Each band only moves toward price, unless the previous close crossed it.
The line is the lower band while the trend is up and the upper band while it is down. direction is 1 up and -1 down. ATR is Wilder's average true range.