Skip to content

trend indicator

Supertrend backtesting — Supertrend

Supertrend is a trend-following overlay that plots a single line, derived from ATR, that sits below price in an uptrend and above it in a downtrend, flipping sides when the trend reverses. It combines volatility measurement with a simple binary state, making it one of the more directly testable trend tools in the catalog.

Try Supertrend on BTC/USDT ETH/USDT SOL/USDT

How Supertrend works

Supertrend starts from ATR to build upper and lower bands offset from the midpoint of high and low by a chosen multiple of ATR. While price stays in an uptrend, the plotted line tracks the lower band, only ratcheting upward — it never lowers with a temporary pullback. If price closes below that line, the trend flips: Supertrend switches to tracking the upper band above price, and stays there until price closes back above it. CandleTest computes Supertrend with TradingView-parity math. Because the line only ever sits on one side of price, the natural no-code rule is the direction flip itself, or simply whether the current direction is bullish or bearish.

Supertrend settings

ATR Lengthdefault 10

The ATR lookback window feeding the band calculation. Shorter lengths make the bands adapt quickly to recent volatility changes; longer lengths produce a steadier, slower-adjusting band.

Factordefault 3

The ATR multiplier that sets how far the bands sit from the price midpoint. Higher factors give the trend more room before flipping, producing fewer but later signals; lower factors flip sooner and more often.

Example Supertrend strategies to backtest

Supertrend flip entry

Enter long when Supertrend’s direction flips bullish. Exit when direction flips bearish.

Trend-strength confirmation

Enter long when Supertrend’s direction flips bullish and ADX is above 25 — only taking flips when the broader trend has real strength behind it.

Every rule above is buildable in the no-code strategy builder — pick conditions, press run, and get win rate, drawdown and equity curve on real exchange data with fees and leverage modeled.

Supertrend FAQ

Does Supertrend work in sideways markets?

Like any trend-following, always-in-the-market system, it tends to flip repeatedly and lose money when price chops sideways with no sustained direction. Backtesting over a ranging period on your market quantifies exactly how costly that whipsaw tends to be.

What do the ATR length and factor control?

The ATR length sets how quickly the underlying volatility measure adapts, and the factor sets how far the bands sit from price — a higher factor gives a trend more room to breathe before flipping, at the cost of giving back more profit on the eventual reversal. The right combination is an empirical trade-off best explored with a backtest sweep.

Is Supertrend better than a moving-average crossover?

Neither is universally better — Supertrend adapts to volatility while a moving-average crossover does not, but that adaptivity does not guarantee superior results on every market. Backtesting both against the same rule and pair is the only reliable comparison.

Is CandleTest’s Supertrend the same as TradingView’s?

Yes — the ATR band and flip logic follow TradingView conventions and are unit-tested for parity against known values.

Related indicators