ATMResearch
Join Overfit - free
Overfit cover card on dark navy, kicker 'Trend-following study': the headline 'The famous 20-day exit lost to a plain calendar.' over the line 'The 40 in / 20 out rule, tested 1,188 ways — what survived, what didn't.', with a corner badge reading 'SPY · 1993–2026'.
  1. Overfit/
  2. Research/
  3. Donchian Channel Strategy: I Backtested '40 In, 20 Out' 1,188 Ways on 33 Years of SPY

June 6, 2025

Donchian Channel Strategy: I Backtested '40 In, 20 Out' 1,188 Ways on 33 Years of SPY

Share

7 min read

Written by Ali Casey, founder of StatOasis and AlgoChef, creator of the Algo Trading Masterclass (ATM), with over 10 years of experience building systematic trading tools - building algorithmic strategies, testing ideas with data, and teaching traders how to build structured, portfolio-based trading workflows.

Published June 6, 2025 · Updated August 22, 2026 · Method

← Back to Research
Table of contents▾
  • TL;DR — the answer box
  • How we tested
  • Does the 40 in, 20 out strategy still make money on the S&P 500?
  • Is the 20-day-low exit actually the right exit?
  • Do longer breakouts really get stronger?
  • Why doesn't shorting breakouts work on stocks?
  • Do trend and volatility filters fix false breakouts?
  • Has the breakout edge decayed?
  • The verdict — and the honest limits
  • What this means for you
  • Methodology
  • FAQs

The short version

I tested the classic 40-in/20-out channel breakout 1,188 ways on 33.4 years of SPY. Long-only it still makes money — 84 trades, $10,550.27 on a $10,000 account, frictionless — but the famous 20-day-low exit is the weak part: a plain 20-bar time exit beat it on risk, 0.20 of annual return per unit of drawdown against 0.10. Every unfiltered short version lost money.

TL;DR — the answer box

  • The classic 40 in, 20 out — buy a close above the 40-day high, sell a close below the 20-day low — still makes money long-only on SPY: 84 trades over 33.4 years, $10,550.27 net on a $10,000 account (105.5% total, frictionless), 47.6% win rate, 2.7% CAR.
  • The famous exit is the weak link. A plain 20-bar time exit beat the 20-day-low channel exit on every risk measure: 3.71 CAR vs 2.69, 18.2% max drawdown vs 26.3%, CAR/MaxDD 0.20 vs 0.10.
  • Buy-and-hold beat both on raw return — 8.8% CAR (price-only) — but with a 56.5% max drawdown. The breakout system's case is survival, not speed: roughly half the market exposure and half the drawdown.
  • The short side is a graveyard. Every unfiltered breakdown entry lost money; the 10-day version lost $18,266.49 with a 181.1% max drawdown — the account didn't just underperform, it died.
  • The edge is decaying. Average 20-day return after a 40-day breakout: 0.851% in 1993–1999, 0.272% in the 2000s, 0.268% in the 2010s, 0.016% in 2020–2026.

How we tested

If you've ever watched a market close at a new 40-day high and wondered whether chasing it is discipline or delusion — this is for you.

Last year I published an article on this exact strategy: the hedge-fund trend rule so old and so simple it feels like it can't possibly still work. Buy when price closes above its highest high of the last 40 days. Sell when it closes below its lowest low of the last 20. That piece made the argument from history. This rebuild makes it from the engine — every claim re-tested, and a few of my own conclusions overturned in the process. I explain the strategy's logic in The Hedge Fund Strategy No One Talks About on the StatOasis YouTube channel; this article is the unfiltered test.

The setup, in plain English. A Donchian channel is nothing more than the highest high and the lowest low of the last N days — two lines, no math beyond a maximum and a minimum. A channel breakout system buys strength (a close above the upper line) and exits on weakness (a close below the lower line). No prediction, no targets. The bet is that new highs lead to more new highs — that trends, once started, persist.

We tested it on SPY daily data from 1993-02-02 to 2026-06-12 — 8,398 bars, 33.4 years. The engine found 805 breakout events (a close above the prior 40-day high) and ran 1,188 backtest variants: two directions, six entry lengths (10/20/40/55/100/150 days), eleven exits (channel exits at 10/20/40/55 days head-to-head against fixed holds of 0–20 bars), and a 3×3 grid of volatility and trend regime filters. Every entry fills at the next bar's open — no look-ahead. Account: $10,000, full-account shares, no compounding, flat-only, frictionless. Every number below comes from the study's locked facts file, computed straight from the result CSVs.

Does the 40 in, 20 out strategy still make money on the S&P 500?

Yes — long-only, and modestly. The classic configuration, no filters:

Metric40 in / 20 out (Long)SPY buy-and-hold
Net result on $10,000$10,550.27 (105.5%)16.7x multiple
CAR (annual return)2.7%8.8% (price-only)
Max drawdown26.3%56.5%
Time in market51.4%100%
Trades84 (2.5/yr)—
Win rate47.6%—
Profit factor1.75—

Profit factor — gross wins divided by gross losses — of 1.75 means the winners paid for the losers with real room to spare. The average win was $613.98 against an average loss of $318.38, a payoff ratio of 1.93: classic trend following, losing slightly more often than it wins but winning nearly twice as big.

Notice what the comparison actually says, though. Buy-and-hold made more than three times the annual return. The breakout system's entire case is the other two rows: it slept in cash almost half the time, and its worst valley was 26.3% deep against the index's 56.5%. This is a strategy you keep because you can survive it, not because it makes you rich. Survival is the product.

Is the 20-day-low exit actually the right exit?

I expected the channel exit to defend its crown. It didn't.

Same entries — a close above the 40-day high — eleven different ways out, long, no filters:

ExitTradesNet profitWin%CARMaxDD%CAR/MaxDDExposure%
Channel 10-day low119$7,285.1544.51.8429.00.0642.8
Channel 20-day low (the classic)84$10,550.2747.62.6926.30.1051.4
Channel 40-day low55$16,435.4056.44.2520.40.2164.3
Channel 55-day low41$20,765.4263.45.4025.00.2271.8
Hold 3 bars439$2,149.5158.50.5414.20.0420.9
Hold 10 bars256$6,335.9061.31.7921.20.0833.5
Hold 20 bars174$12,916.3166.13.7118.20.2043.5

Two results here are worth the whole study.

First: the dumb time exit won its head-to-head. Holding every breakout for exactly 20 bars — no signal, no channel, just a calendar — beat the classic 20-day-low exit on net profit ($12,916.31 vs $10,550.27), max drawdown (18.2% vs 26.3%), and return-to-drawdown (0.20 vs 0.10), with a 66.1% win rate. The celebrated exit rule spent three decades being outperformed by "sell in a month."

Second: if you do use a channel exit, wider is better. The 40-day-low exit more than doubled the classic's CAR/MaxDD (0.21 vs 0.10), and the 55-day exit posted the best raw numbers in the table — $20,765.42 net, 63.4% win rate — but on only 41 trades, which is below our 50-trade reliability bar. Flagged, not trusted.

The pattern behind both results is the same: the classic 20-day exit is tight enough to get shaken out of trends it was right about, and every re-entry pays the breakout's chop tax again. Give the trend room — with a wider channel or a fixed clock — and the same entries earn more with less pain.

Same entries, eleven exits. The celebrated channel exit (0.10) lost to a calendar (0.20).

Do longer breakouts really get stronger?

The original article leaned on trend-following folklore: the longer the lookback, the more meaningful the breakout. The sweep says otherwise — on SPY, entries get weaker as they get longer:

EntryTradesNet profitWin%CARMaxDD%CAR/MaxDD
10-day high128$12,740.6046.12.9042.30.07
20-day high102$14,457.9146.13.7632.90.11
40-day high84$10,550.2747.62.6926.30.10
55-day high80$6,312.5743.81.4628.10.05
100-day high69$6,621.2647.81.6619.50.09
150-day high65$5,197.7349.21.2421.40.06

(All with the classic channel-20 exit, long, no filters.) The 20-day entry — the shortest one with a tolerable drawdown — beat the 150-day entry's CAR three times over, 3.76 to 1.24. Why? Because of something the events file makes embarrassingly clear: 74.2% of SPY's 40-day-high breakouts were also 200-day-plus highs. In an index that drifts up, a long-lookback breakout isn't an early trend signal — it's a late arrival at a party that's been running for months. The fresh breakouts carried the juice: events that broke the 40-day high but not yet the 55-day high averaged +1.457% over the next 20 days, versus +0.106% for breakouts at 200-day-plus highs.

CAR by entry length, channel-20 exit. On an up-drifting index, the long lookback arrives late.

One honest flag before you optimize: the single best reliable variant in the whole grid (entry 10, hold 20, trend filter on) posted a 0.37 CAR/MaxDD on 205 trades. It's a real cell, and it's also exactly the kind of lone peak I tell you not to trust. A grid maximum is a starting hypothesis, never a conclusion — that's the difference between testing for robustness and curve-fitting.

Why doesn't shorting breakouts work on stocks?

It doesn't just "not work." It ruins you. Mirrored breakdowns — a close below the prior N-day low, covered at the N-day-high channel — long-side logic flipped honestly:

EntryTradesNet profitWin%CARMaxDD%
10-day low146−$18,266.4918.5−5.81181.1
20-day low102−$16,214.4121.6−5.21160.9
40-day low67−$13,621.5520.9−4.33135.9
55-day low48−$7,905.2425.0−2.5979.6
Every breakdown entry, every lookback: negative. The two thinnest cells are flagged, not celebrated.

A max drawdown above 100% means the $10,000 account was gone before the backtest finished — the 10-day short variant drew down 181.1%. Across the entire grid, only 117 of 594 short variants ended positive, and those live almost entirely in thin, heavily-filtered cells our reliability rule flags anyway. This confirms the strongest claim from the original article with harder evidence than it had: on an index with a structural upward drift, selling weakness is a fight against the house. Markets are not random — and on equity indices the non-randomness points up. It's the same asymmetry we found when the identical breakout rule behaved differently on the Nasdaq, S&P, and Dow: the market you trade decides what your rule is worth.

Do trend and volatility filters fix false breakouts?

First, the uncomfortable base rate. False breakouts aren't an edge case — they're the norm: 94.2% of the 805 breakouts retested the broken level within 60 bars, and 53.0% touched it on the entry day itself. Within 20 bars, 80.1% of events traded at least +1% above entry at some point and 68.1% traded at least −1% below. The average best excursion (+2.57%) barely outweighed the average worst (−2.75%). A breakout entry buys you a coin-flip's worth of immediate comfort, and no filter changes that.

What the locked regime filters did change is the shape of the ride. On the classic 40/20 long:

Filter stateTradesNet profitCARMaxDD%CAR/MaxDD
No filters84$10,550.272.6926.30.10
ATR(20) rising only56$9,977.532.7314.60.19
SMA(100) rising only74$8,953.392.3318.30.13
Filters didn't add profit. They cut the drawdown nearly in half — that's what they're for.

ATR — average true range, a standard gauge of recent daily movement — turned out to be the filter that mattered. Taking only breakouts while volatility was expanding kept almost all the profit on a third fewer trades and nearly halved the worst drawdown, doubling CAR/MaxDD from 0.10 to 0.19. The trend filter helped less. Neither turned water into wine; both bought a smoother seat. That's the general lesson of regime filters: they decide when your edge is worth taking, and on SPY, big-range, high-volatility conditions are when breakouts earn their keep.

Has the breakout edge decayed?

Decade by decade, from the events layer (every breakout measured, overlaps kept):

PeriodEventsAvg 5-day returnAvg 20-day return% positive at 20 days
1993–1999173+0.198%+0.851%66.5%
2000–2009150−0.260%+0.272%60.7%
2010–2019279+0.129%+0.268%63.1%
2020–2026203−0.036%+0.016%62.6%
The same signal, four eras. The last bar is barely visible — that is the finding.

The direction of travel is one way. The 1990s paid a breakout buyer +0.851% over the next month; the 2020s paid +0.016% — statistical noise. Breakouts still resolve upward more often than not (62.6% positive even now), but the size of the follow-through has been arbitraged to almost nothing on this index. Momentum persistence is real and centuries old; that doesn't obligate it to be large, here, now.

The verdict — and the honest limits

Where the original claim holds: the strategy is real. Long-only channel breakouts on the S&P 500 made money across 33 years, through three crashes, on rules you can write on an index card. The short side is exactly as dead as claimed — deader, actually, with data. Simple survived.

Where the folklore breaks: the famous parts tested worst. The 20-day-low exit — the "20 out" in the name — lost to a plain 20-bar clock. Longer entry lookbacks weakened results on SPY instead of strengthening them. And the per-breakout payoff has decayed every decade to near zero in the 2020s. The rule's skeleton works; its mythology doesn't.

One strategy on one market is a solo instrument. Trend following was always written for an orchestra — the hedge funds this rule comes from never traded it on one index; they traded it on dozens of markets at once and let diversification carry what no single market could. That portfolio test is the natural next study, on real futures data with proper roll treatment.

The limits, because a study that hides them isn't worth trusting:

  • Frictionless. No commission or slippage. At 2.5 trades a year the damage is small, but real costs shrink every number here.
  • The buy-and-hold benchmark is price-only. With dividends reinvested, SPY's true CAR is higher than the 8.8% shown — the honest comparison is worse for the strategy, not better.
  • Thin cells are flagged, not trusted. The channel-55 exit's headline rests on 41 trades; several filter combinations run thinner. Across the grid, 608 of 1,188 variants clear the 50-trade bar.
  • One market, one instrument. SPY the ETF, not index futures — no leverage, no roll costs, and conclusions about "trend following" beyond US large-caps are not licensed by this data.
  • Decade rows are overlapping events, not independent samples — read them as drift, not as seven independent experiments.
  • No compounding, fixed $10,000. Deliberate — it keeps 1990s trades and 2020s trades comparable — but it means dollar figures are not what a compounding account would show.

What this means for you

  1. If you trade this on SPY, trade it long-only. The short side lost under every entry length tested — worst case −$18,266.49 on a $10,000 account.
  2. Rethink your exit before your entry. The 20-bar time exit beat the classic channel exit (0.20 vs 0.10 CAR/MaxDD). Wider channels (40/55) beat tight ones. Exit mythology is the cheapest thing to test and the most profitable thing to fix.
  3. Don't assume longer lookbacks are stronger — test your market. On SPY the 20-day entry beat the 150-day threefold on CAR. On another market the ranking may flip; that's the point of testing.
  4. Use the volatility filter if drawdown is what kills you. ATR-rising nearly halved max drawdown (26.3% → 14.6%) at almost no cost to profit.
  5. Size for the 26.3% drawdown, not the equity curve. If the worst valley in the backtest would make you quit, the strategy was never yours.
  6. Judge it as a portfolio ingredient, not a lottery ticket. 2.7% CAR at half exposure with half the market's drawdown is a diversifier — pair it with mean-reversion tools like Casey Bands rather than asking it to be your whole account.

Methodology

Data source
SPY (S&P 500 ETF) daily OHLCV, 1993-02-02 through 2026-06-12 (8,398 bars), from the StatOasis research dataset.
Date range
1993-02-02 to 2026-06-12 (33.4 years); 805 breakout events from 1993-05-27 to 2026-06-02.
Entry / exit rules
Event: a close above the highest high of the prior 40 days (grid sweeps 10/20/40/55/100/150). Entry at the next bar's open — no look-ahead. Exits swept head-to-head: channel exits (close below the lowest low of the prior 10/20/40/55 days, filled next open) versus fixed holds of 0–20 bars (exit at that bar's close). Shorts are mirrored breakdowns, not inverted longs.
Sizing
$10,000 starting capital, full-account shares (floor of capital ÷ entry price), no compounding, flat-only — one position at a time. Frictionless: no commission or slippage.
Overlap mode
The backtest is flat-only (overlapping signals skipped while in a trade); the events layer measures every breakout with overlaps kept.
Look-ahead
The breakout is confirmed on the close of bar t and filled at the open of bar t+1. Channel exits are signalled on a close and filled at the next open for the same reason. No number here uses information that was unavailable at the moment of the decision.
Minimum sample
50 trades. 608 of the 1,188 variants clear it; thinner cells are flagged, never dropped.
Buy-and-hold benchmark
SPY over the same window on the study's own $10,000 sizing basis: $157,639.52 net, 8.82% CAGR, and a worst drawdown of 56.47% in March 2009 (CAR over that drawdown, 0.098).
Random control
Frequency-matched seeded coin flip on SPY - 133 entries and a 5-bar hold, the study's own median reliable variant - averaged over 10 seeds from base seed 20260803: $2,275.77 net (sd $1,980.45), a 22.22% worst drawdown, CAR over that drawdown 0.026, 57.05% win rate. Computed by tools/controls_report.py.
Parameter scopeParameters swept

The study searched the parameter space and reports the spread, not one tuned setting.

1,188 variants: entry channels of 10/20/40/55/100/150 days, channel exits of 10/20/40/55 days tested head-to-head against fixed holds of 0-20 bars, both directions. The article reports the spread across that space rather than one tuned setting.

Run to v1 of the StatOasis research standard - the rules every study here has to meet before it is published. The version is the study's own: a standard that gained a rule later never reaches back and claims this one met it.

Historical backtest results are not a guarantee of future returns. This content is for educational purposes only and is not investment advice. Hypothetical performance disclosure (CFTC Rule 4.41).

Frequently asked questions

Does the Donchian channel strategy still work?⌄

Long-only on SPY, yes — barely. The classic 40-in/20-out made $10,550.27 on a $10,000 account over 33.4 years (84 trades, 47.6% win rate, 2.7% CAR, frictionless). But the edge has decayed: the average 20-day return after a breakout fell from +0.851% in 1993–1999 to +0.016% in 2020–2026.

What are the best Donchian channel settings — 20, 40, or 55 days?⌄

On SPY, shorter entries beat longer ones: the 20-day entry produced a 3.76% CAR versus 2.69% for the 40-day and 1.24% for the 150-day (channel-20 exit, no filters). Exits are the opposite — longer is better: the 40-day-low exit reached a 4.25% CAR versus 2.69% for the classic 20-day-low. Treat any single best cell as suspect until it survives more markets.

Is 40 in, 20 out the same as the Turtle trading system?⌄

Same family — Donchian-style channel breakouts. The Turtles famously used 20- and 55-day entries; both are in our sweep. On SPY 1993–2026 the 20-day entry earned a 3.76% CAR and the 55-day entry 1.46% (channel-20 exit, long, no filters), so the family works but the exact lengths matter less than direction.

Does trend following beat buy-and-hold on the S&P 500?⌄

Not on raw return. The best unfiltered long variant at entry 40 earned a 4.25% CAR versus 8.8% for buy-and-hold (price-only, no dividends). It wins on risk: a 20.4% max drawdown versus 56.5%, while being in the market only 64.3% of the time.

Why doesn't shorting breakouts work on stock indices?⌄

Because indices drift up. Every unfiltered short entry length lost money — the 10-day breakdown lost $18,266.49 on a $10,000 account with a 181.1% max drawdown, meaning the account was destroyed. Only 117 of 594 short variants in the entire grid finished positive, mostly thin filtered cells.

How do you avoid false breakouts in a channel strategy?⌄

You mostly can't — you manage them. 94.2% of SPY's 40-day breakouts retested the broken level within 60 bars, and 53.0% touched it on the entry day itself. The honest fixes are structural: trade long only, and use a volatility filter — entering only when ATR(20) was rising raised CAR/MaxDD from 0.10 to 0.19.

What's the difference between Donchian channels and Keltner channels?⌄

A Donchian channel is pure price — the highest high and lowest low of the last N bars — which makes it the natural breakout tool. A Keltner channel wraps a moving average with an ATR multiple, so it measures stretch from average price instead of new extremes. This study is pure Donchian: the entry is a close above the prior 40-day high.

Do trend or volatility filters improve a breakout strategy?⌄

They improved risk, not riches. On the classic 40/20 long, taking signals only when ATR(20) was rising cut trades from 84 to 56, kept net profit close ($9,977.53 vs $10,550.27), and nearly halved the max drawdown to 14.6% — lifting CAR/MaxDD from 0.10 to 0.19.

↓Download the dataset (543 KB)

Read the Strategies, Backtested hub
← Back to Research

Table of contents

  • TL;DR — the answer box
  • How we tested
  • Does the 40 in, 20 out strategy still make money on the S&P 500?
  • Is the 20-day-low exit actually the right exit?
  • Do longer breakouts really get stronger?
  • Why doesn't shorting breakouts work on stocks?
  • Do trend and volatility filters fix false breakouts?
  • Has the breakout edge decayed?
  • The verdict — and the honest limits
  • What this means for you
  • Methodology
  • FAQs

Overfit - the newsletter

Skip the hype. Trust the data.One practical takeaway per issue.

Running a quick security check before this can be sent.

Delivered +2 times a month - when the work is ready, not on a calendar.I'll never sell your address.Unsubscribe in one click, any time.

Related Articles

Back to all research
#122

Robustness Testing: Why Most Traders Fail, and What 36,252 Backtests Say Actually Works

Mar 28, 2025 · 16 min read

Robustness testing is the step between a good backtest and a strategy worth funding. I measured which checks actually predict what happens next, then retested the whole thing on 53 markets — where the stack still works, several individual checks turn out to have been overstated threefold, and two of them stop working entirely.

Read more→
#134

Same Breakout Strategy, Different Results: Nasdaq vs. SP500 vs. Dow

Jun 20, 2025 · 3 min read

Compare how the same breakout strategy performs on Nasdaq, S&P 500, and Dow. The results may surprise you.

Read more→
#118

Mastering Market Regimes: When to Trade and When to Stay Out

Mar 7, 2025 · 5 min read

Discover how market regimes define trends & volatility, impact trading strategies and how traders can use them to optimize their strategies.

Read more→
#139

Coin Flip Trading: What Randomness Tells Us About Market Bias

Oct 11, 2025 · 5 min read

Coin flip backtests show hidden market tendencies in ES, NG, and AD.

Read more→

Overfit - the newsletter

Skip the hype. Trust the data.

One practical, evidence-driven takeaway per issue - strategy testing, portfolio construction, market structure, trading psychology, tactical asset allocation.

Running a quick security check before this can be sent.

Delivered +2 times a month - when the work is ready, not on a calendar.I'll never sell your address.Unsubscribe in one click, any time.

StatOasis is calm, evidence-based algorithmic-trading education, founded by Ali Casey. Ali builds systematic trading strategies and teaches the workflow behind them: research, build, test, combine, deploy. He writes the Overfit newsletter, published since 2024, and runs the Algo Trading Masterclass.

Socials

  • X ↗
  • YouTube ↗
  • Instagram ↗
  • LinkedIn ↗
  • GitHub ↗
  • Muck Rack ↗
  • LinkedIn SO ↗
  • GitHub SO ↗

Products

  • Overfit - the newsletter
  • Algo Trading Masterclass ↗
  • StatOasis Community
  • Digital Products
  • 36 Ways to Buy the Dip
  • AlgoChef ↗

Reading & tools

  • Research
  • Methodology
  • Survive the Decade
  • Wall of Love

StatOasis

  • About Ali Casey
  • Contact
© 2026 StatOasis. Calm, evidence-based.
PrivacyTermsHypothetical resultsCalifornia