An ATR-based trailing line that plots either above or below price depending on the active trend. When the line is below price, the trend is up. When it flips above, the trend is down. Cleaner visually than older trend-trailing indicators, with explicit direction signals built into the outputs.
Supertrend(10, 3) on MES 5m — alternating uptrend and downtrend
What it measures
- Trend direction. Single binary state — uptrend or downtrend. Encoded both visually (line color/position) and as the Direction output (1 or −1).
- Volatility-adjusted trailing line. The distance between price and the Supertrend line scales with ATR — wider in volatile conditions, tighter in calm.
- Flip events. The
is_flippedoutput explicitly marks the bar where the trend reverses, ready for entry triggers.
Formula
How AlgoLift computes it
Step 1 — bands:
HL2 = (High + Low) / 2
upper_band = HL2 + (multiplier × ATR(period))
lower_band = HL2 − (multiplier × ATR(period))
Step 2 — trend logic:
- Start with the bands.
- If the previous close was above the previous upper band, the trend was already up. Continue tracking the lower band as the trailing line.
- If the previous close was below the previous lower band, the trend was already down. Continue tracking the upper band.
- Flip when price closes through the active band.
Step 3 — outputs:
- Uptrend Line = the lower band when trend is up (else null).
- Downtrend Line = the upper band when trend is down (else null).
- Direction = 1 (up) or −1 (down).
The clever part: only ONE of the two output lines is active at a time. This is what makes Supertrend's visual presentation work — there's never both an uptrend and downtrend line visible.
Developed in the early 2000s as an evolution of the older Parabolic SAR concept.
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| ATR Period | 10 | 1–200 | Lookback for the ATR calculation. |
| ATR Multiplier | 3.0 | 0.1–20.0 | How many ATRs the band sits from the midpoint. Higher = less sensitive, fewer flips. |
Recommended settings
- (10, 3.0) — default: Standard. Balanced sensitivity for intraday and swing.
- (7, 2.0): Faster — more flips, suitable for short-term scalping.
- (14, 4.0): Slower — fewer flips, for swing strategies on higher timeframes.
The multiplier matters more than the period. Going from 3.0 to 2.0 changes the flip frequency dramatically; going from period 10 to 14 doesn't change as much.
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| Uptrend Line | Numeric | Always | The active line when trend is up (null otherwise). |
| Downtrend Line | Numeric | Always | The active line when trend is down (null otherwise). |
| Direction | Numeric | On select | 1 = uptrend, −1 = downtrend. The cleanest binary trend flag. |
| Is Flipped | Numeric | On select | 1 on the bar where the trend just flipped, 0 otherwise. Use for entry triggers. |
| Upper Band (Raw) | Numeric | On select | The pre-trend-logic upper calculation. |
| Lower Band (Raw) | Numeric | On select | The pre-trend-logic lower calculation. |
Supertrend node — default state with all six outputs
Reading the components together
The visual line + the Direction output gives you everything in a glance:
- Green line below price (Uptrend Line active): Buy bias.
- Red line above price (Downtrend Line active): Sell bias.
- Is Flipped = 1: Trend just changed this bar. Often used as an entry trigger.
- Direction × position size: The Direction output can be multiplied directly with a base position size for a "always-in-the-direction-of-Supertrend" strategy.
Supertrend is the most strategy-ready trend indicator in the library. The Direction output (1 or −1) and Is Flipped (1 or 0) are designed specifically for wiring into entry logic — no smoothing, no thresholds, no judgment calls about what "trending" means.
Best in / worst in
Best in trending markets with clear directional runs, on instruments with reasonable volatility (most futures, major equity indices). Excellent for "always in the market in the trend direction" strategies.
Worst in sideways chop where Supertrend whipsaws (flips) every few bars. Also weak around news events where a single large bar can trigger a premature flip.
Three setups
1. Always-in-trend strategy
The textbook Supertrend pattern — always hold a position in the indicator's current direction.
- Long entry / short exit: Is Flipped = 1 AND Direction = 1.
- Short entry / long exit: Is Flipped = 1 AND Direction = −1.
Combined with size = base × Direction, the strategy holds a flat-then-long-then-short sequence aligned with each flip.
Always-in-trend Supertrend strategy
2. Supertrend as a trend filter
Use Supertrend Direction as a regime gate for any other strategy.
- Long-only mode: Supertrend Direction = 1 — other strategies (RSI mean-reversion, Bollinger pullback, etc.) only take long entries.
- Short-only mode: Supertrend Direction = −1 — other strategies take short entries only.
A clean no-tuning regime classifier.
3. Supertrend pullback to the line
Wait for a pullback to the Supertrend line in an established trend.
- Long: Direction = 1 AND price touches within 0.5× ATR of the Uptrend Line AND price closes back above the line.
- Short: Symmetric.
The pullback pattern improves R:R compared to flip-entry, at the cost of fewer signals.
Advanced patterns in AlgoLift
Supertrend as the trailing stop for unrelated strategies. Use the active Supertrend line (Uptrend Line for long positions, Downtrend Line for shorts) directly as the trailing stop level. The ATR-based scaling means the stop adapts to volatility automatically. Wire via Set Stop Loss.
Supertrend exit + ATR re-entry combo. Exit positions on Supertrend flip. Re-enter on the next signal from a different system (RSI, MACD) only if Supertrend has flipped back to your direction since exit. Filters out re-entries during prolonged counter-trends.
Multi-Supertrend confluence. Run two Supertrend instances at different multipliers (e.g., 3.0 and 5.0) as separate nodes. Trade only when both agree on direction. The slower one filters out the faster one's whipsaws.
Supertrend Direction in a Conditional Flow. Route the strategy between two different entry logics based on Supertrend Direction. When Direction = 1, run a long-bias pullback strategy; when Direction = −1, run a short-bias breakdown strategy. Single graph handles both regimes.
Supertrend Direction as a strategy-routing flag
Common mistakes
- Trading every flip without context. Flips in chop produce continuous whipsaw losses. Always combine with a longer-period regime filter (SMA(200), ADX, KAMA).
- Setting the multiplier too low to "catch more signals." Lower multiplier = more flips = more losses in chop. Multiplier 2.0 vs 3.0 doesn't just change signal count — it dramatically changes the strategy's loss profile.
- Using Supertrend on too-short timeframes. The ATR-based bands need enough bar movement to be meaningful. Below 5-minute bars, the indicator becomes noise.
- Ignoring the Is Flipped output. Many users only read the visual line. Is Flipped = 1 is the explicit "trend just changed" signal — designed exactly for entry triggers.