SPY daily data, 2016 to 2026: the 20, 2.0 rule, long and short, lost 34.9% after costs over 83 trades, winning 36.1% of them, against +277.8% for holding SPY. Long only it made 12.8%. The best of 7 runs was 20, 2.0 on NVDA, long only: +987.2%, held-out survived. Every run, every trade and the script are on this page.
Answers here: Does the Keltner Channel breakout work? · 2 ATR or 1.5 ATR? · What is the win rate? · Long only, or both ways?
SPY daily data, 4 January 2016 to 23 October 2026, long and short: 83 trades, lost 34.9% after costs, 36.1% of trades won, profit factor 0.74, worst drawdown 47.2%, 44% of the time in the market. Holding SPY returned +277.8% over the same period.
Held out on its own, the last third (16 March 2023 to 23 October 2026) lost 2.8% on 25 trades: it did not survive its held-out period.
Long only, the same rule made 12.8% on 51 trades (45.1% won, profit factor 1.31, held-out survived): the short side cost 47.7 points of return in a period when SPY rose 277.8%.
Across all 7 runs on this page, 4 made money after costs, 4 survived the held-out third, and 0 beat holding the symbol.
The best run was 20, 2.0 on NVDA, long only: +987.2% net on 47 trades, profit factor 3.75, worst drawdown 25.4%, held-out survived. The tester's verdict on it reads "real edge so far · check the test period".
Keltner Breakout Strategy, from the strategy library.
Breakout: goes long when the close crosses above the upper Keltner Channel (20-period EMA, 2 ATR) and goes short when it crosses below the lower one; the trade closes when the close crosses back through the middle line. A stop sits 2 ATR away. A tighter 1.5 ATR channel was run on SPY, and long-only versions on SPY, QQQ and NVDA.
The indicator itself, with its Pine code drawn on real market data: Keltner Channels.
Net and holding the symbol are after costs over the same period. Held-out is the verdict on the last third of the history judged alone: survived, decayed, did not survive, or too few trades to judge.
| Symbol | Timeframe | Settings | Direction | Trades | Win rate | Net | Holding | Profit factor | Max drawdown | Held-out |
|---|---|---|---|---|---|---|---|---|---|---|
| SPY | daily | 20, 2.0 | long and short | 83 | 36.1% | -34.9% | +277.8% | 0.74 | 47.2% | did not survive |
| NVDA | daily | 20, 2.0 | long and short | 73 | 41.1% | +272.9% | +25955.3% | 1.83 | 46.8% | survived |
| SPY | daily | 20, 1.5 | long and short | 113 | 31.9% | -27.5% | +277.8% | 0.89 | 39.8% | did not survive |
| QQQ | daily | 20, 2.0 | long and short | 89 | 33.7% | -42.7% | +542.3% | 0.78 | 50.1% | did not survive |
| SPY | daily | 20, 2.0 | long only | 51 | 45.1% | +12.8% | +277.8% | 1.31 | 17.6% | survived |
| QQQ | daily | 20, 2.0 | long only | 51 | 47.1% | +51.5% | +542.3% | 1.83 | 16.9% | survived |
| NVDA | daily | 20, 2.0 | long only | 47 | 51.1% | +987.2% | +25955.3% | 3.75 | 25.4% | survived |
20, 2.0 on SPY, long and short, the same rule long only, and SPY itself, each calendar year after costs. A partial first or last year counts the sessions it has.
| Year | 20, 2.0, long and short | 20, 2.0, long only | Holding SPY |
|---|---|---|---|
| 2016 | -2.1% | +3.4% | +11.2% |
| 2017 | +1.4% | +1.4% | +18.5% |
| 2018 | -5.7% | -1.6% | -6.9% |
| 2019 | -8.9% | +3.2% | +28.6% |
| 2020 | -1.9% | -6.1% | +15.1% |
| 2021 | -3.6% | 0.0% | +28.8% |
| 2022 | -14.0% | -3.5% | -19.9% |
| 2023 | -1.9% | +9.0% | +24.8% |
| 2024 | -6.5% | +0.1% | +24.0% |
| 2025 | -4.0% | +0.5% | +16.6% |
| 2026 | +6.4% | +6.5% | +11.2% |
The 83 trades of 20, 2.0 on SPY, long and short, oldest first: side, entry and exit days, fill prices after slippage, and the return after both commissions. The other runs' trades open below.
| Side | In | Out | Entry | Exit | Return |
|---|---|---|---|---|---|
| long | 2016-03-04 | 2016-04-29 | 200.07 | 205.78 | +2.8% |
| long | 2016-06-09 | 2016-06-13 | 211.57 | 208.88 | -1.4% |
| short | 2016-06-28 | 2016-06-29 | 201.42 | 204.88 | -1.8% |
| long | 2016-07-13 | 2016-08-29 | 215.50 | 217.38 | +0.8% |
| short | 2016-09-12 | 2016-09-12 | 212.33 | 216.64 | -2.1% |
| short | 2016-11-03 | 2016-11-08 | 209.92 | 212.76 | -1.5% |
| long | 2016-11-22 | 2017-01-03 | 220.58 | 224.97 | +1.9% |
| long | 2017-01-26 | 2017-01-30 | 229.47 | 226.38 | -1.4% |
| long | 2017-02-13 | 2017-03-22 | 232.15 | 233.70 | +0.6% |
| long | 2017-06-02 | 2017-06-28 | 243.48 | 242.43 | -0.5% |
| long | 2017-07-20 | 2017-08-10 | 247.35 | 244.64 | -1.2% |
| long | 2017-09-13 | 2017-11-09 | 249.80 | 256.70 | +2.7% |
| long | 2017-11-29 | 2018-02-05 | 263.10 | 273.39 | +3.8% |
| short | 2018-02-06 | 2018-02-07 | 259.92 | 270.54 | -4.2% |
| short | 2018-02-09 | 2018-02-12 | 260.72 | 266.32 | -2.2% |
| short | 2018-03-23 | 2018-04-11 | 264.08 | 263.56 | +0.1% |
| long | 2018-06-07 | 2018-06-22 | 278.03 | 275.58 | -1.0% |
| long | 2018-07-19 | 2018-07-30 | 280.39 | 279.69 | -0.3% |
| long | 2018-08-08 | 2018-08-15 | 285.47 | 281.23 | -1.6% |
| long | 2018-08-28 | 2018-09-26 | 290.38 | 289.69 | -0.3% |
| short | 2018-10-11 | 2018-11-02 | 277.00 | 274.82 | +0.7% |
| short | 2018-12-18 | 2019-01-08 | 257.12 | 256.89 | 0.0% |
| long | 2019-02-05 | 2019-03-07 | 272.55 | 275.19 | +0.9% |
| long | 2019-04-05 | 2019-05-06 | 288.00 | 289.17 | +0.3% |
| short | 2019-05-14 | 2019-05-16 | 281.94 | 288.03 | -2.3% |
| short | 2019-06-03 | 2019-06-05 | 275.24 | 282.41 | -2.7% |
| long | 2019-06-20 | 2019-08-01 | 296.12 | 297.52 | +0.4% |
| short | 2019-08-06 | 2019-08-08 | 285.83 | 290.98 | -1.9% |
| short | 2019-10-03 | 2019-10-07 | 287.74 | 295.14 | -2.7% |
| long | 2019-11-04 | 2019-12-03 | 307.94 | 308.56 | +0.1% |
| long | 2019-12-13 | 2020-01-06 | 316.96 | 320.40 | +1.0% |
| long | 2020-01-10 | 2020-01-27 | 327.38 | 322.94 | -1.5% |
| long | 2020-02-13 | 2020-02-24 | 335.95 | 323.05 | -3.9% |
| short | 2020-02-25 | 2020-04-07 | 323.84 | 274.29 | +15.2% |
| long | 2020-06-03 | 2020-06-12 | 310.32 | 308.15 | -0.8% |
| long | 2020-08-06 | 2020-09-04 | 331.57 | 335.75 | +1.2% |
| long | 2020-10-13 | 2020-10-22 | 352.36 | 340.61 | -3.4% |
| short | 2020-10-29 | 2020-11-03 | 326.82 | 338.32 | -3.6% |
| long | 2020-11-17 | 2021-01-28 | 360.06 | 376.25 | +4.4% |
| long | 2021-02-09 | 2021-02-23 | 389.72 | 380.60 | -2.4% |
| long | 2021-04-06 | 2021-05-04 | 405.87 | 412.20 | +1.5% |
| long | 2021-07-02 | 2021-07-19 | 431.79 | 426.07 | -1.4% |
| long | 2021-07-27 | 2021-08-18 | 440.03 | 438.80 | -0.4% |
| long | 2021-08-31 | 2021-09-10 | 452.25 | 446.99 | -1.3% |
| short | 2021-09-21 | 2021-09-23 | 436.41 | 443.03 | -1.6% |
| short | 2021-10-01 | 2021-10-07 | 430.86 | 439.26 | -2.0% |
| long | 2021-10-21 | 2021-11-26 | 451.88 | 462.25 | +2.2% |
| short | 2022-01-20 | 2022-02-02 | 453.63 | 455.62 | -0.5% |
| short | 2022-02-24 | 2022-03-02 | 410.91 | 439.80 | -7.1% |
| long | 2022-03-30 | 2022-04-06 | 460.47 | 445.50 | -3.3% |
| short | 2022-04-25 | 2022-05-27 | 423.54 | 408.04 | +3.6% |
| short | 2022-06-14 | 2022-06-24 | 376.75 | 387.65 | -3.0% |
| long | 2022-08-01 | 2022-08-23 | 409.26 | 412.79 | +0.8% |
| short | 2022-08-31 | 2022-09-09 | 399.82 | 406.24 | -1.7% |
| short | 2022-09-22 | 2022-10-05 | 376.48 | 379.24 | -0.8% |
| long | 2022-11-14 | 2022-12-06 | 396.77 | 393.33 | -1.0% |
| long | 2023-02-03 | 2023-02-21 | 411.70 | 402.95 | -2.2% |
| short | 2023-03-13 | 2023-03-21 | 381.70 | 398.22 | -4.4% |
| long | 2023-04-04 | 2023-04-26 | 411.72 | 406.61 | -1.3% |
| long | 2023-06-05 | 2023-08-03 | 428.42 | 447.92 | +4.5% |
| short | 2023-08-18 | 2023-08-29 | 433.25 | 445.41 | -2.9% |
| short | 2023-09-22 | 2023-10-09 | 432.34 | 431.65 | +0.1% |
| short | 2023-10-27 | 2023-11-02 | 414.08 | 426.70 | -3.1% |
| long | 2023-11-13 | 2024-01-05 | 439.34 | 467.36 | +6.3% |
| long | 2024-01-22 | 2024-04-04 | 484.14 | 514.36 | +6.1% |
| short | 2024-04-22 | 2024-04-24 | 497.71 | 507.00 | -2.0% |
| long | 2024-05-15 | 2024-05-31 | 525.97 | 523.44 | -0.6% |
| long | 2024-06-13 | 2024-07-18 | 543.29 | 550.69 | +1.3% |
| short | 2024-08-06 | 2024-08-13 | 519.08 | 537.65 | -3.7% |
| long | 2024-10-15 | 2024-10-31 | 584.75 | 572.69 | -2.2% |
| long | 2024-11-07 | 2024-11-18 | 593.24 | 586.06 | -1.3% |
| long | 2024-12-03 | 2024-12-18 | 603.54 | 593.04 | -1.8% |
| short | 2024-12-19 | 2024-12-24 | 591.20 | 597.42 | -1.2% |
| long | 2025-01-24 | 2025-01-27 | 609.97 | 594.67 | -2.6% |
| short | 2025-02-28 | 2025-03-25 | 585.40 | 575.45 | +1.6% |
| short | 2025-04-04 | 2025-04-25 | 523.59 | 546.80 | -4.5% |
| long | 2025-05-13 | 2025-08-01 | 583.62 | 623.82 | +6.8% |
| long | 2025-08-14 | 2025-08-20 | 642.95 | 633.30 | -1.6% |
| long | 2025-09-12 | 2025-10-10 | 657.76 | 663.27 | +0.7% |
| long | 2025-10-28 | 2025-11-06 | 687.25 | 670.58 | -2.5% |
| short | 2026-03-23 | 2026-04-07 | 657.87 | 656.81 | +0.1% |
| long | 2026-04-14 | 2026-06-05 | 687.87 | 743.79 | +8.0% |
| long | 2026-08-05 | 2026-08-21 | 776.04 | 765.84 | -1.4% |
Pine v6, exactly as it ran for 20, 2.0 on SPY, long and short. The variants change only the inputs listed in the table.
//@version=6
strategy("Keltner Breakout Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=100000, commission_type=strategy.commission.percent, commission_value=0.05, slippage=1, margin_long=0, margin_short=0)
src = input.source(close, "Source", group="Setup")
len = input.int(20, "EMA length", minval=1, group="Setup")
mult = input.float(2, "ATR multiplier", minval=0.1, step=0.1, group="Setup")
useLong = input.bool(true, "Trade longs", group="Direction")
useShort = input.bool(true, "Trade shorts", group="Direction")
atrLen = input.int(14, "ATR length", minval=1, group="Risk")
stopMult = input.float(2, "Stop (ATR multiples, 0 = off)", minval=0, step=0.5, group="Risk")
[mid, upper, lower] = ta.kc(src, len, mult, true)
atr = ta.atr(atrLen)
longSig = ta.crossover(close, upper) and barstate.isconfirmed
shortSig = ta.crossunder(close, lower) and barstate.isconfirmed
exitLong = ta.crossunder(close, mid) and barstate.isconfirmed
exitShort = ta.crossover(close, mid) and barstate.isconfirmed
pU = plot(upper, "Upper line", color=color.new(#16A56A, 20), linewidth=1)
pL = plot(lower, "Lower line", color=color.new(#E5484D, 20), linewidth=1)
plot(mid, "Mid line", color=color.new(#A3A39E, 0), linewidth=1)
fill(pU, pL, color=color.new(#A3A39E, 94), title="Channel fill")
if longSig and useLong
strategy.entry("Long", strategy.long)
strategy.exit("Long stop", "Long", stop=stopMult > 0 ? close - stopMult * atr : na)
if shortSig and useShort
strategy.entry("Short", strategy.short)
strategy.exit("Short stop", "Short", stop=stopMult > 0 ? close + stopMult * atr : na)
if exitLong
strategy.close("Long")
if exitShort
strategy.close("Short")
Alpaca daily data since 2016, 0.05% commission and 0.025% slippage on every fill, the last third of the history held out, textbook settings and nothing tuned. The engine, fills and what it does not model are written out once, in data and methodology.
Describe the rule in your own words or paste the script. The Free plan writes the Pine v6 script with the AI, runs it on any US stock or ETF with the same costs and the same held-out check, and shows every trade on the chart. No card.
Seventeen popular rules through the same engine, the same costs and the same held-out check, with every trade listed. Next: Bollinger Bands strategy, Donchian breakout (turtle) strategy, SuperTrend strategy.
SPY, daily data, 2016 to 2026, long and short: 20, 2.0 lost 34.9% after costs over 83 trades (36.1% won, profit factor 0.74) against +277.8% for holding SPY, and the held-out third did not survive. Long only it made 12.8%. Across all 7 runs on the page, 4 made money after costs, 4 survived their held-out third and 0 beat holding the stock.
From 31.9% to 51.1% across the 7 runs. The classic setting, 20, 2.0 on SPY long and short, won 36.1% of 83 trades. The win rate alone does not decide the result: that run's profit factor was 0.74, so its losers outweighed its winners, and the net return was -34.9%.
Of the 2 settings tested, 20, 2.0 on NVDA (long only) did best: +987.2% net, profit factor 3.75, held-out survived. That is the best of 7 tries on 10.8 years of daily data of one symbol, which is already a fitted number. A setting that works on one symbol or one period only is a coincidence, not a setting; run it on your own symbol and timeframe before trusting it.
0 of the 7 runs did. SPY itself returned +277.8% between 4 January 2016 and 23 October 2026, so a rule that is out of the market part of the time has a lot to make up; what a timing rule usually gets you is a smaller drawdown, not a bigger return. The classic run's worst drawdown was 47.2% with 44% of the time in the market.
The last third of every run's history (16 March 2023 to 23 October 2026 for the lead run) was judged on its own, with no fitting on it: 4 of 7 runs survived, 0 decayed, 3 did not survive and 0 had too few trades there to judge. Survived means a positive Sharpe ratio on the held-out part at least half the fitted period's; it is a check on one later stretch, not a forecast.
With the free Alpha Charts tester's own engine: the Pine v6 scripts on this page, run on Alpaca daily data since 2016, split-adjusted and not dividend-adjusted, one position at a time with the whole account, fills at the next candle's open, a commission of 0.05% and slippage of 0.025% on every fill, the last third of the history held out. The settings are the textbook ones and every variant is stated; nothing was tuned to make the page look better.
Every number on this page is the output of the Alpha Charts backtest engine on 25 October 2026, on Alpaca market data; the scripts are the strategy library's templates, shown as they ran. Symbols are US-listed ETFs and stocks; results are price returns after the costs stated. Past results are not a forecast and nothing here is investment advice. TradingView and Pine Script belong to TradingView, Inc.; Alpha Charts is not affiliated with it.