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

NameTypeDefault
highArrayLike
lowArrayLike
closeArrayLike
atr_periodint10
factorfloat3.0

Indicator: SuperTrend

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) -> None

Trend-following line built from the average true range.

Inputs

NameTypeDefaultRange
atr_periodint101 to 500
factorfloat30.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.