TL;DR: the answer box
- What it is. Upper line = highest high of N bars. Lower line = lowest low of N bars. Middle = (upper + lower) / 2. On SPY on 2026-08-20 the 20-day channel read 779.37, 729.10 and 754.24.
- How it is traded. Buy a close above the prior upper line (the breakout), or buy a close below the prior lower line (the fade). Exit at a channel line or after a fixed number of bars.
- The breakout won with the drift. On the side each market moved over the window, 283 of 300 trend variants made money. Against it, 43 of 300. On the 7 stock index markets: long 131 of 140, short 0 of 140.
- Against a matched random entry, few cleared the bar. Each variant was set beside 100 seeded random-entry runs with the same side and exit. Per bar held, 111 of 900 beat the random 95th percentile, where chance alone gives about 45. Trend long on stock indices: 3 of 140.
- The fade did better on stock indices. Buying the lower line made money in 67 of 70 long variants there, and 15 of 70 beat the random 95th percentile per bar held.
What is a Donchian channel?
A Donchian channel is a price channel built from two numbers: the highest high and the lowest low of the last N bars. A third line, the middle, sits halfway between them.
Richard Donchian, an early systematic trend follower, used it to decide when a market had broken out. The calculation is the same on TradingView and in StockCharts' ChartSchool, and it is the one used here.
How is the Donchian channel calculated?
Three lines, each one bar at a time:
- Upper line = the highest high of the last N bars.
- Lower line = the lowest low of the last N bars.
- Middle line = (upper + lower) / 2.
Here is SPY's 20-day channel at the close of 2026-08-20: upper 779.37, lower 729.10, middle (779.37 + 729.10) / 2 = 754.24. That day's close was 762.60, inside the channel. Channel width 50.27.
One detail trips up almost everyone who codes it. The current bar is inside its own window, so a close can never be above the same bar's upper line. A breakout compares today's close with yesterday's line. "A close above the 20-day high" means above the highest high of the 20 bars before today.
How do you trade the Donchian channel?
Two ways, and they point in opposite directions.
The trend rule (the breakout). Donchian's own use, and the one the Turtles made famous.
- Entry: buy when the close breaks above the prior upper line. Short when it breaks below the prior lower line.
- Exit, four versions tested: the close crosses the opposite line of the same channel, or the opposite line of a faster channel (entry/exit lengths 10/5, 20/10, 55/20, 100/50 and 200/100, where 55/20 is the Turtles' System 2 pair), or the middle line. The fourth sells 20 bars after entry.
The fade rule (mean reversion). The channel read as a stretch that snaps back.
- Entry: buy when the close breaks below the prior lower line. Short when it breaks above the prior upper line.
- Exit, two versions tested: the close crosses back over the middle line, or 5 bars after entry.
Here is one trade from the headline setting, 20 bars in and 10 out, the Turtles' System 1 pair. On 2025-08-12 SPY closed above its prior 20-day high of $639.85. The position bought 54 shares at the next open, $644.91. 42 bars later a close fell below the prior 10-day low, and it sold at the next open, $660.65: $850. One trade explains the rule. It proves nothing. The 900 below are the test.
How I tested it
My own turning point came in 2014, from the Turtle Traders: simple systems plus proper risk management. So I wanted to know what the simple part, the channel, does on its own.
The sweep. Channel lengths of 10, 20, 55, 100 and 200 bars. Six rule and exit pairs (four trend, two fade). Long and short. That is 60 variants per market, 900 in all.
The markets. 15, one window for all: entries from 2004-01-02 to 2026-08-20, 22 years. Seven US stock index markets (SPY, QQQ, IWM, DIA, ES, NQ, YM) and eight others: gold (GC), natural gas (NG), gasoline (RB), the 10-year Treasury note (ZN), wheat (ZW), sugar (SB), the euro (6E) and the Japanese yen (6J). Crude oil was left out: its back-adjusted price goes below zero inside the window.
Sizing and costs. $35,000 in whole ETF shares or one futures contract per trade, no compounding, no stop loss. Frictionless headline. After the engine's cost schedule, 360 of the 381 profitable variants on the 12 costed markets stayed profitable.
Execution rule v2. The signal is read at the close and the trade buys the next open. A channel exit is decided at a close and sells the next open. One position at a time.
The control. Every variant was set beside 100 seeded random-entry runs: the same number of entry signals placed at random closes, the same side, the same exit rule. The only difference is where the entries fall. Two scores: average trade, and profit per bar held. The second matters, because a breakout entry sits far from its exit line, so it holds longer than a random entry under the same exit. In a rising market a longer hold earns more whatever the entry.
Does the Donchian channel strategy work?
It made money on the side each market drifted. Against that side, it rarely did.
"With the drift" means long on a market whose buy and hold made money from 2004 to 2026, and short on one whose buy and hold lost money. Eleven markets rose. Four fell: the euro, the yen, natural gas and wheat.
| Group | Variants | Made money |
|---|---|---|
| Trend rule, with the drift | 300 | 283 (94.3%) |
| Trend rule, against the drift | 300 | 43 (14.3%) |
| Trend long, 7 stock index markets | 140 | 131 |
| Trend short, 7 stock index markets | 140 | 0 |
Trend rule, 5 channel lengths x 4 exits x 2 sides per market, 2004-01-02 to 2026-08-20.
Two markets broke the pattern. On gasoline (RB) and sugar (SB) the trend rule made money on both sides, 13 or more of 20 variants each. They were the only two markets where both sides cleared 13 of 20.
Read the drift grouping for what it is. It uses each market's whole 22-year result, which nobody had in 2004. It tells you where the money came from. It is not a rule you could have traded.
Does a Donchian breakout beat a random entry?
Per bar held, mostly not.
Think of the drift as a tide. A boat drifting with the tide reaches harbour whether or not anyone steers. The random control is that unsteered boat: same side, same exit, entries anywhere. If the breakout's timing adds something, the breakout should beat it.
| Group | Variants | Made money | Beat random, average trade | Beat random, per bar held |
|---|---|---|---|---|
| Trend long, stock index markets | 140 | 131 | 46 | 3 |
| Trend short, stock index markets | 140 | 0 | 0 | 0 |
| Trend, other 8, with the drift | 160 | 152 | 96 | 40 |
| Trend, other 8, against the drift | 160 | 43 | 25 | 21 |
| Fade long, stock index markets | 70 | 67 | 48 | 15 |
| Fade short, stock index markets | 70 | 8 | 7 | 16 |
"Beat random" = above the 95th percentile of 100 random-entry runs with the same side and exit. Chance alone puts about 5% of variants there.
Across all 900 variants, 260 beat the random 95th percentile on average trade, and 111 per bar held. Chance alone gives about 45.
Look at the first row. The trend rule long on stock indices made money in 131 of 140 variants. Per bar held, it beat random entry in 3. In 86 of the 105 versions with a channel exit, the breakout earned less per bar than the median random run with the same exit. Its bigger average trade went with longer holds in a rising market.
Where the timing did show up was away from the stock indices. On the other 8 markets, trend variants on the drift side beat the random 95th percentile per bar held in 40 of 160. By market, the yen led with 14 of 60, then gasoline 12, gold 10 and sugar 10. That fits the time series momentum research of Moskowitz, Ooi and Pedersen, who found trend following across futures markets, though this study tests one market at a time and is not a test of their result.
Beating the control is not the same as making money. The fade short on stock indices beat its control per bar in 16 of 70 variants and made money in 8 of 70. Those 16 outperformed their random controls per bar held, while only 8 of the 70 made money.
Does the Turtles' 20/10 still work?
On the drift side, it made money on all 15 markets. Against it, on 2 of 15.
| Market | Side | Trades | Win rate | Net profit | Profit factor | Ret/DD |
|---|---|---|---|---|---|---|
| SPY | long | 101 | 47.5% | $37,726 | 2.15 | 3.50 |
| SPY | short | 90 | 23.3% | -$42,895 | 0.40 | -0.93 |
| NQ (E-mini Nasdaq 100) | long | 94 | 50.0% | $290,365 | 2.70 | 5.75 |
| GC (gold) | long | 92 | 39.1% | $130,470 | 1.65 | 1.86 |
| NG (natural gas) | short | 101 | 41.6% | $131,510 | 1.87 | 3.55 |
| RB (gasoline) | short | 81 | 38.3% | $45,699 | 1.35 | 1.40 |
| SB (sugar) | long | 82 | 37.8% | $23,957 | 1.57 | 1.63 |
| 6J (Japanese yen) | short | 91 | 46.2% | $39,512 | 1.42 | 1.41 |
Trend rule, 20-bar entry, 10-bar exit channel, frictionless. All 30 market-sides are in the facts sheet.
On the 7 stock index markets, 20/10 long made money on all 7, with win rates of 41.9% to 53.1% and profit factors of 1.25 to 2.70. Short, it lost money on all 7.
Against random entry, 20/10 beat the 95th percentile on average trade on 8 of 30 market-sides. Per bar held, on 3: NQ long, gasoline short and sugar long.
The profit is lumpy. On SPY, 48 of 101 trades won, and the top 10 trades made $34,812 of the $37,726 total. This SPY run leaned on its 10 best trades.
And buy and hold earned more. On the 11 markets that rose, 20/10 long out-earned simply holding on 1, sugar. On SPY, $37,726 against $203,719, while 20/10 sat in the market 52.5% of the time. This is a timing rule on one market. Buy and hold stayed long the whole time and never switched sides.
Which exit and which length worked best?
No one setting won on every count. On the drift side:
| Exit | Made money | Median profit factor | Median Ret/DD | Median trades | Median bars per trade |
|---|---|---|---|---|---|
| Opposite line, same channel | 73 of 75 | 2.04 | 1.94 | 28 | 137.2 |
| Opposite line, faster channel | 73 of 75 | 1.72 | 1.72 | 52 | 46.3 |
| Middle line | 72 of 75 | 1.66 | 2.09 | 51 | 48.1 |
| 20 bars | 65 of 75 | 1.54 | 1.92 | 103 | 20.0 |
Trend rule with the drift, all 5 lengths and 15 markets.
The slowest exit had the highest median profit factor, 2.04, and held trades for a median 137.2 bars on 28 trades. The 20-bar time exit beat the random 95th percentile per bar held most often, 20 of 75, against 3 to 13 for the channel exits. A time exit is also the fairest comparison with the control, because both hold the same number of bars.
Length ran the same way. The 200-bar channel had a median profit factor of 3.09 on a median of 13 trades. The 20-bar channel made money in 60 of 60 variants on a median of 104 trades. The highest median profit factor came with the fewest trades. This study flags a variant below 50 trades as thin. 495 of the 900 clear that floor.
Can you trade the Donchian channel the other way?
On stock indices, the fade held up better than the breakout.
Buying a close below the prior lower line made money in 67 of 70 long variants on the 7 stock index markets, with a median profit factor of 1.77. Per bar held, 15 of 70 beat the random 95th percentile. The trend rule long on the same markets: 3 of 140.
| Market | Fade long, 20-bar, middle exit: trades | Win rate | Net profit | Profit factor | 20/10 trend long net |
|---|---|---|---|---|---|
| SPY | 106 | 77.4% | $44,937 | 3.08 | $37,726 |
| QQQ | 93 | 78.5% | $40,964 | 2.34 | $60,693 |
| IWM | 99 | 73.7% | $38,202 | 1.91 | $15,359 |
| DIA | 99 | 76.8% | $32,487 | 2.19 | $28,827 |
| ES | 98 | 77.6% | $120,225 | 2.52 | $135,525 |
Fade rule, long, 20-bar channel, exit at the middle line, frictionless.
Off the stock indices it did not travel: 31 of 80 long fade variants made money on the other 8 markets. If you trade stock indices, the dip side is tested in depth in 36 Ways to Buy the Dip.
The verdict, and the honest limits
The Donchian channel is a clean, honest indicator. Two numbers, three lines, no smoothing, nothing to repaint.
The breakout made money on the side the market drifted. 283 of 300 trend variants with the drift, 43 of 300 against it. On stock indices, long 131 of 140, short 0 of 140.
Per bar held, few variants beat a random entry. Across both rules, 111 of 900 cleared the random 95th percentile, where chance gives about 45. On the stock indices the long breakout cleared it 3 times in 140. Away from the stock indices it did better: 40 of 160 trend variants on the drift side.
On stock indices, the fade beat the breakout against the control. 15 of 70 against 3 of 140.
Limits. One window, 2004 to 2026: a market that turns for the next 20 years changes which side wins. One contract or $35,000 per trade, no stop, no volatility sizing, no pyramiding and none of the Turtles' filters, so this tests the channel rule, not the Turtle system. In the main sweep each market is traded alone. The one portfolio run, 18 markets, is in the last section. A position still open on the last bar is discarded. Futures are back-adjusted continuous contracts, with roll costs not modelled beyond that.
What this means for you
- Treat the side as the first research question, before the length. This study tested no way to pick the side in advance, but in this sweep profitability split sharply by side: 283 of 300 with the drift made money, 43 of 300 against it.
- Know what shorting breakdowns did on stock indices here. From 2004 to 2026, 0 of 140 short trend variants made money on the 7 stock index markets.
- Test your breakout against a random entry with the same exit, per bar held. On stock indices the long breakout made money in 131 of 140 variants and beat that control in 3.
- On stock indices, look at the lower line too. Fading it beat the control per bar in 15 of 70 long variants.
- Count trades before you trust a profit factor. The 200-bar channel's median of 3.09 sat on a median of 13 trades.
Does trend following need a portfolio?
Read every per-market number above with one caveat: on a handful of markets, the result swings with which markets you picked. I drew 3 of 18 markets at random 1,000 times, all three settings on each, and the Sharpe ratio ran from -0.27 to +0.22 (5th to 95th percentile), with 58.3% of the picks losing money. The published research tests trend following as a broad, diversified book, and the book did better than its parts. Hurst, Ooi and Pedersen report 67 markets from 1880 to 2016 at a Sharpe of 0.76 after fees and costs, against about 0.4 for a single market before fees, and positive returns in every decade. Moskowitz, Ooi and Pedersen found positive trend returns in all 58 futures markets they tested from 1985 to 2009, before costs. So the per-market results above are not a verdict on trend following as funds trade it.
Diversification is no guarantee either. I ran that design at a small scale: 18 markets, the 20/10, 40/20 and 80/35 settings, long and short, equal risk per market and per setting, 2004 to 2026. It still lost: a Sharpe of -0.03, -$65,689 on $1,000,000, a worst drawdown of 30.4% of capital and 13 losing years out of 23. With costs, on the 14 markets where the engine has a tick size, it lost more. Real money shows how hard this is: an NBER study found CTAs (managed-futures funds) earned 0.85% a year over Treasury bills after fees from 1994 to 2007, and the AQR series made 3.3% a year from 2010 to 2016. The research behind it used 58 to 67 markets. This 18-market book lost, and costs made it worse. A 40-plus-market book was not tested here. And this check used channel breakouts, not the 1 to 12 month signals the research tests, so it does not settle the question.
The SPY-only deep dive on the 40-day entry is 40 In, 20 Out, and the same random-control method run on breakout entries across the Nasdaq, the S&P 500 and the Dow is in the breakout trading study. Testing your own rule against random entry and Monte Carlo is what AlgoChef is for.
The channel draws the lines. The market decides which side pays.
Want the next study when it is finished? That is what the newsletter is for: StatOasis.com/Overfit
Methodology and honesty footer: 900 variants of the Donchian channel trend and fade rules (channel lengths 10, 20, 55, 100 and 200 bars, six exits, long and short) on 15 markets, daily bars, entries 2004-01-02 to 2026-08-20. $35,000 in whole ETF shares or one futures contract per trade, no compounding, no stop. Execution rule v2 timing (signal at the close, fill at the next open), frictionless headline with a costed figure on 12 markets. Every variant set beside 100 seeded random-entry runs with the same side and exit. Every number comes from the study's facts sheet. AlgoChef is the author's own product. This is research, not investment advice.








