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.
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.
Top assets by out-of-sample Sharpe
The loss column
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
Get the weekly edge report
The best-performing indicator per asset, what changed this week, and the honest caveats — straight to your inbox.