Supertrend 3.0
ATR-based trend-following indicator that places dynamic bands above and below price. When price crosses a band, the trend direction flips and a signal is emitted.
How it works
Supertrend computes two bands from the Average True Range (ATR):
Upper band = (high + low) / 2 + multiplier * ATR(period)
Lower band = (high + low) / 2 - multiplier * ATR(period)The active band depends on the current trend direction:
- Uptrend: the lower band acts as dynamic support. If price closes below the lower band, trend flips to down.
- Downtrend: the upper band acts as dynamic resistance. If price closes above the upper band, trend flips to up.
The bands ratchet: in an uptrend, the lower band can only move up, locking in gains as the trend extends. In a downtrend, the upper band can only move down.
A signal is emitted only on the bar where direction transitions between -1 and +1. Between flips the strategy stays in the existing position — trailing-stop adjustments are the executor's responsibility, not a new signal every candle.
ATR is SMA-seeded then Wilder-smoothed. Direction state is integer (1 / -1), not a float comparison — this ensures byte-identical output across the backtest and live paths.
Parameters
| Parameter | Description | Default |
|---|---|---|
atr_period | Lookback for Average True Range | 10 |
multiplier | ATR multiplier from median price | 3.0 |
The "3.0" variant uses a multiplier of 3.0, balancing noise filtering and responsiveness. Tighter multipliers (2.0) produce more signals; wider (4.0) produce fewer.
Performance
| Metric | Value |
|---|---|
| Validated timeframes | D1, 8h |
| Mean Sharpe | 0.90 |
| Multi-asset validated | BTC, ETH, SOL |
Natural stop loss
The emitted sl_price is the Supertrend band itself. In a long position, the lower band is the invalidation point. Position sizing uses the standard formula:
Quantity = (Account * Risk%) / |Entry - Supertrend Band|No separate ATR-based stop calculation is needed — the band is the stop.
Sizing
SizeHint::VolatilityTarget with target_vol_daily from params and realized_vol estimated from a 30-bar log-return window. The bot's sizing layer converts the hint and current equity into final quantity.
When it works well
- Sustained trends: the ratcheting band lets profits run while tightening the stop.
- Higher timeframes: D1 and 8h filter out most noise. Below 4h, signal quality degrades significantly.
- Volatile assets: ATR-based construction adapts naturally to volatility — higher vol means wider bands, fewer false flips.
When it struggles
- Choppy, range-bound markets: trend flips back and forth, generating whipsaw losses.
- Low timeframes: intraday noise causes frequent false signals.
- Sudden V-shaped reversals: the band lags price, so exits can be late.
Implementation
Source: gordon-strategy/src/engines/supertrend/mod.rs
The implementation is byte-equivalent to the archived monolith (gordon-trading/crates/gordon-indicators/src/supertrend.rs). The CI byte-parity gate (tests/it_backtest_live_byte_parity.rs) verifies this at every push.
Related
- EWMAC — complementary strategy, works better at lower timeframes (1h–6h)
- PSAR — similar timeframe range (D1), different mechanism (accelerating dots)
- Adding a Strategy — how Supertrend was validated