◆ New — Strategy Validator, Code Fixer & Prop Compliance Checker are live. Try one free →
Home / Indicators / Supertrend
Trend indicator

Supertrend

An ATR-based trend-following overlay that plots a single line above or below price to track the prevailing direction.

Illustrative diagram — not live market data.

What it is

Supertrend is a trend-following overlay that draws one line on the price chart. The line sits below price during an uptrend and above price during a downtrend, flipping sides when price closes through it. It uses the Average True Range (ATR) to set how far the line trails from price, so its distance adapts to volatility. It is a lagging, reactive tool that describes the current trend state rather than predicting future movement, and like all indicators it cannot forecast price.

How it works

Supertrend starts from a midpoint of each bar (the average of the high and low, often written hl2) and adds or subtracts a multiple of ATR to build an upper and a lower band. The ATR multiple (the "factor") controls band width: higher volatility pushes the bands further from price. The indicator then locks in whichever band is active based on how price has been closing. When price closes above the upper band, the trend is read as up and the lower band is shown; when price closes below the lower band, the trend flips to down and the upper band is shown. The visible line ratchets in the trend's favor and only switches sides when price decisively closes past it, which is what produces the characteristic stair-step line and the flip points.

How traders read it

Common settings

A factor (ATR multiplier) of 3.0 with an ATR period of 10 is a widely used default. Lower factors (e.g. 1.5-2) make the line flip more often and hug price more closely; higher factors (e.g. 4+) flip less often and sit further away. Shorter ATR periods react faster and are noisier; longer ones are smoother and slower.

Strengths

Pitfalls to watch

Pine v6 example

//@version=6
indicator("Supertrend Example", overlay = true)

atrPeriod = input.int(10, "ATR Period")
factor    = input.float(3.0, "Factor")

[supertrend, direction] = ta.supertrend(factor, atrPeriod)

// direction < 0 means uptrend (line below price), > 0 means downtrend (line above price)
upTrend   = direction < 0 ? supertrend : na
downTrend = direction > 0 ? supertrend : na

plot(upTrend,   "Up Trend",   color = color.green, style = plot.style_linebr)
plot(downTrend, "Down Trend", color = color.red,   style = plot.style_linebr)

Pro tip: Some traders read Supertrend on a higher timeframe to gauge the broader trend state, then look at a lower timeframe for context rather than acting on every flip, and they often confirm it with momentum or volume tools, since Supertrend can whipsaw heavily in ranging markets. This is educational context, not a recommendation to trade, and no indicator can predict price.

Built an indicator from this? Run it through the Validator to catch look-ahead bias and repainting, or convert a strategy to Pine Script.

Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.

Catch the bug that compiles.Run auditGet Pro