Home / Toolkit / Edge Supertrend (10,3)
Free & open source · MIT

Edge Supertrend (10,3)

Long while the Supertrend direction is bullish; flat otherwise. Signal evaluated at bar close, acted on at the next bar (no lookahead). The same class of signal sold in premium trend-flip signal overlays packages — except the code is below, and so are the receipts.

886
assets tested (daily bars)
23.7%
beat buy & hold out-of-sample
42.4%
median win rate (OOS)
0.26
median Sharpe (OOS)
Read the receipts before you trade it

On the median asset this rule underperformed buy-and-hold by 6.7% CAGR out-of-sample, with a median max drawdown of -42.8%. Arrows on a chart are not an edge — asset selection is. Use it where it's proven to hold up (below), skip it everywhere else. No one selling signals will print this paragraph; that's why we do.

Where it held up

Top assets by out-of-sample Sharpe

Where it failed worst

The loss column

The code

Full Pine Script source

TradingView → open the Pine Editor (bottom panel) → paste → "Add to chart". Settings: ATR 10 (Wilder), multiplier 3.0, hl2 basis.

//@version=5
// ─────────────────────────────────────────────────────────────────────────────
// Edge Supertrend (10,3) — free & open source. Part of the IndicatorEdge Edge Toolkit.
// Receipts (out-of-sample backtests across 700+ assets, incl. where it LOSES):
//   https://indicatoredge.io/toolkit/edge-supertrend
// Same rule our engine tested: long while the Supertrend direction is bullish,
// flat otherwise. Signals print at bar close and the published stats assume you
// act at the NEXT bar — no lookahead, 0.08%/side costs. License: MIT.
// Educational/hypothetical — not financial advice.
// ─────────────────────────────────────────────────────────────────────────────
indicator("Edge Supertrend (10,3) — IndicatorEdge", overlay = true)

atrPeriod = input.int(10, "ATR period", minval = 1)
factor    = input.float(3.0, "ATR multiplier", minval = 0.5, step = 0.1)

[st, dir] = ta.supertrend(factor, atrPeriod)   // Wilder ATR, hl2 basis — matches the engine
bull = dir < 0

plot(bull ? st : na, "Trend support",    color = color.new(#2dd4bf, 0), linewidth = 2, style = plot.style_linebr)
plot(bull ? na : st, "Trend resistance", color = color.new(#f87171, 0), linewidth = 2, style = plot.style_linebr)

flipUp = bull and not bull[1]
flipDn = not bull and bull[1]
plotshape(flipUp, "Long signal", shape.labelup,   location.belowbar, color.new(#2dd4bf, 0), text = "LONG", textcolor = color.white, size = size.small)
plotshape(flipDn, "Exit signal", shape.labeldown, location.abovebar, color.new(#f87171, 0), text = "EXIT", textcolor = color.white, size = size.small)

alertcondition(flipUp, "Edge Supertrend — LONG", "Supertrend flipped bullish (engine acts next bar open)")
alertcondition(flipDn, "Edge Supertrend — EXIT", "Supertrend flipped bearish (engine acts next bar open)")

Published stats were computed by our engine with this exact rule: long/flat, signal at bar close acted on the next bar, 0.08% costs per side, out-of-sample = final 30% of each asset's history. Educational information only — not investment advice. Hypothetical backtested results; past performance does not guarantee future results. Trading involves risk of loss.

More from the toolkit

Free · no spam

Get the weekly edge report

The best-performing indicator per asset, what changed this week, and the honest caveats — straight to your inbox.