SuperTrend
All indicators

LibraryTrend

Indicator

SuperTrend

A trailing line from the ATR that sits below price in an uptrend and above it in a downtrend, and changes side when price breaks through it.

TrendOn the price2 inputsSuperTrend

How it is calculated

The basic bands are the bar's midpoint (high plus low, halved) plus and minus mult times the ATR, Wilder's ATR seeded with the mean of the first length true ranges. The upper band only moves down and the lower only up, unless the previous close broke through. An uptrend turns down when the close falls below the lower band, a downtrend up when it closes above the upper. First value on bar length, counting from 0; direction is +1 up, -1 down.

Reference: Seban (SuperTrend)

How to read it

The line is the stop of the current trend, and a change of side is the signal. In strong trends it keeps a position open; in sideways markets it flips often and each flip costs. A larger multiplier means fewer and later flips.

In a strategy

Trend following on the flip: long when ctx.ind("supertrend", length=10, mult=3.0).direction turns from -1 to 1, with .supertrend as the trailing Stop-Loss.

Inputs

InputTypeDefaultRange or choices
ATR lengthlengthWhole number10min 1, max 5000
MultipliermultNumber3min 0.1, max 20

What it draws

LineDrawn as
SuperTrendLine

Used in

No strategy template reads it yet.

OrionQuant