20-day breakout: backtest results
A Donchian / Turtle-style breakout: buy a close above the 20-day high, exit on a close below the 10-day low. We ran it on real daily data for 4 stocks. It beat simply buying and holding on 1 of 4 stocks.
Results by stock
| Stock | Period | Strategy | Buy & hold | Beat it? | Worst drop | Trades | Win rate | Caution |
|---|---|---|---|---|---|---|---|---|
| Apple (AAPL) | 2016 → 2025 | +462.6% | +1038.8% | no | -30.9% | 36 | 66.7% | includes a position still open at the end |
| Amazon (AMZN) | 2016 → 2025 | +195.5% | +613.2% | no | -35.5% | 44 | 54.5% | |
| Robinhood (HOOD) | 2021 → 2025 | +292.0% | +223.5% | yes | -58.1% | 13 | 61.5% | fell 58% at its worst |
| Tesla (TSLA) | 2016 → 2025 | +865.9% | +2877.2% | no | -46.7% | 42 | 38.1% | fell 47% at its worst |
Best: Tesla on +865.9%. One set of rules, fixed in advance, run on every stock: no tuning to make the numbers look better. A strategy with few trades or a big drop deserves less trust than its return suggests.
The exact rules
Buy Apple when the close crosses above the 20 day highest high. Sell when the close crosses below the 10 day lowest low.
Paste those words into Extractor and it runs the same test, shows every trade on the chart with entry, stop loss and take profit, and compares it with buy & hold. Change a number and run it again in seconds.
Run these rules now, freeFree TradingView indicator (Pine Script v5)
Copy this into TradingView's Pine Editor and click Add to chart. It marks the buy and sell signals and draws the levels.
//@version=5
// Indicator generated by Extractor from your rules.
// Built for AAPL on the daily (1D) chart.
// Buy when: close crosses above highest_high(20)
// Sell when: close crosses below lowest_low(10)
// Marks where your rules say buy and sell, and adds alerts you can turn on in TradingView.
indicator("20-day breakout signals", overlay=true)
hh20 = ta.highest(high, 20)[1]
ll10 = ta.lowest(low, 10)[1]
cross1 = ta.crossover(close, hh20)
cross2 = ta.crossunder(close, ll10)
entrySignal = cross1
exitSignal = cross2
// Track whether the rules are in a trade, so signals don't repeat while already long.
var bool inTrade = false
var float entryPrice = na
stopHit = false
targetHit = false
buy = not inTrade and entrySignal
sell = inTrade and (exitSignal or stopHit or targetHit)
if sell
inTrade := false
entryPrice := na
else if buy
inTrade := true
entryPrice := close
// Levels stay drawn through the bar where the trade closes.
wasInTrade = inTrade or sell
levelBase = sell ? entryPrice[1] : entryPrice
plot(hh20, "Highest high 20", color.orange)
plot(ll10, "Lowest low 10", color.aqua)
plotshape(buy, "Buy", shape.labelup, location.belowbar, color.new(color.teal, 0), text="BUY", textcolor=color.white, size=size.small)
plotshape(sell, "Sell", shape.labeldown, location.abovebar, color.new(color.red, 0), text="SELL", textcolor=color.white, size=size.small)
alertcondition(buy, "Buy signal", "20-day breakout: buy signal on {{ticker}} at {{close}}")
alertcondition(sell, "Sell signal", "20-day breakout: sell signal on {{ticker}} at {{close}}")
Test your own version
- Different stock, crypto or forex pair? Change the ticker in the description.
- Add a stop loss or take profit and see if it helps.
- Saw a strategy on YouTube? Paste the link and get the rules, the backtest and the indicator.