SuperTrend

A trend line from average true range: below price in an up trend, above it in a down trend.

SuperTrend on Wilder ATR(period): basic bands x ± mult × ATR (x = hl2 by default). The lower band only rises while the previous close stayed above it, the upper band only falls while the previous close stayed below it. The trend turns up when the close ends above the upper band (while the line was the upper band) and down when it ends below the lower band. supertrend = the lower band in an up trend, the upper band in a down trend; the first ready candle starts as a down trend. Ready at period candles.

Settings

SettingDefaultRangeWhat it does
period101 to 500ATR period.
mult30.1 to 20Band distance in ATRs.

What it gives

OutputWhat it is
SuperTrend lineThe trailing line, in price.
Direction+1 in an up trend, −1 in a down trend.

What it reads

It reads open, high, low, close, hl2, hlc3, ohlc4, hlcc4, hl2 by default.

Warm-up

With its default settings, SuperTrend needs 150 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses SuperTrend with its default settings