Strategies we backtested Donchian channel breakout

Tested by BacktestingMax

Donchian channel breakout strategy backtest

Does the Donchian channel breakout strategy work?

Mostly no. In our backtest, the 20-candle Donchian breakout made money on only a few markets, mainly gold and silver. A Donchian channel is the highest high and the lowest low of the last 20 candles. The strategy buys when a candle closes above the channel, and sells short (sells first, to make money if price falls) when a candle closes below it. A close beyond the other side closes the trade and opens one the other way ('stop and reverse'), so a trade is almost always open. On a daily chart, these rules are close to the 'four-week rule' of Richard Donchian, who gave the channel its name. We ran 30 backtests from 2019 to 2025: 10 markets, each on 1-hour, 4-hour and daily charts. The best backtest was USD/JPY on the 1-hour chart: +101.6%. EUR/USD, GBP/USD and the S&P 500 lost money on every chart. The 'Where it worked' box shows 9 of 30: the 10 daily tests are left out, because each has fewer than 100 trades. Of the 30 tests, only the 4-hour tests of gold and silver passed all four of our checks. On daily charts from 2005 to 2025, gold passed them too, but the account grew only 20.1% in 21 years. The results include trading costs, but not overnight fees.

30 backtests 2019–2025 Trading costs included Tested 19 October 2026

Where it worked 30 backtests
Made money
9
of 30 tests, using the standard rules
Made money in both periods
5
2019–2022 and again 2023–2025
Best backtest
+102%
USD/JPY, 1-hour chart: account growth 2019–2025
With a 200-candle moving average filter
4
tests made money in both periods, compared with 5 using the standard rules

Made money in both periods

  • USD/JPY, 1-hour
  • GBP/JPY, 1-hour
  • Gold, 1-hour
  • Gold, 4-hour
  • Silver, 4-hour

The results

Results on every market

Each box shows one backtest of the Donchian channel breakout using the standard rules, from 2019 to 2025, after trading costs: the % result, and a small chart of the account balance. The solid line is the account balance and the dashed line is the starting balance. Green results made money; red results lost money. Under each result: whether it made money in both 2019–2022 and 2023–2025, or passed all four of our checks (see "How a test passes" further down).

Market 1-hour 4-hour daily
EUR/USD −3% Lost money −10% Lost money −5% Too few trades
GBP/USD −27% Lost money −16% Lost money −6% Too few trades
USD/JPY +102% Made money in both periods −2% Lost money +3% Too few trades
GBP/JPY +9% Made money in both periods +6% Made money overall, lost in one period −4% Too few trades
Gold +93% Made money in both periods +23% Passed all four checks +11% Too few trades
Silver +0.8% Made money overall, lost in one period +23% Passed all four checks +14% Too few trades
S&P 500 −33% Lost money −14% Lost money −0.7% Too few trades
Nasdaq 100 −42% Lost money −10% Lost money +8% Too few trades
DAX +17% Made money overall, lost in one period −6% Lost money −12% Too few trades
FTSE 100 −51% Lost money +7% Made money overall, lost in one period −9% Too few trades
All the numbers, test by test
Market Chart Trades Win rate Profit factor Result Max drawdown 2019–2022 2023–2025 Monte Carlo drawdown Trading costs
EUR/USD 1-hour 1,002 34.8% 0.99 −2.7% −36.6% −1.7% −1.0% −43.9% $1,600
EUR/USD 4-hour 255 36.5% 0.89 −10.2% −22.1% +3.4% −13.2% −24.7% $181
EUR/USD daily 49 34.7% 0.69 −4.5% −7.1% −7.1% +2.8% −9.2% $12
GBP/USD 1-hour 1,036 35.3% 0.94 −27.1% −49.2% +18.5% −38.5% −53.2% $1,801
GBP/USD 4-hour 252 34.5% 0.83 −15.5% −20.7% +1.3% −16.6% −27.8% $180
GBP/USD daily 52 32.7% 0.64 −6.1% −6.4% −1.6% −4.5% −10.2% $13
USD/JPY 1-hour 958 36% 1.20 +101.6% −22.5% +62.8% +23.9% −31.3% $1,904
USD/JPY 4-hour 248 31.9% 0.98 −2.2% −12.5% −0.9% −1.3% −25.1% $168
USD/JPY daily 40 42.5% 1.26 +3.0% −4.0% −0.1% +3.1% −5.9% $9
GBP/JPY 1-hour 1,013 35.5% 1.02 +8.6% −30.8% +1.2% +7.3% −40.7% $2,573
GBP/JPY 4-hour 233 37.3% 1.07 +6.2% −9.9% +14.6% −7.4% −19.0% $273
GBP/JPY daily 43 30.2% 0.73 −3.9% −7.7% −0.7% −3.2% −9.4% $15
Gold 1-hour 918 34.5% 1.20 +93.4% −18.0% +17.7% +64.3% −31.8% $1,890
Gold 4-hour 223 34.5% 1.31 +22.7% −6.9% +6.6% +15.1% −14.6% $160
Gold daily 40 35% 1.62 +11.0% −6.5% −1.9% +13.1% −8.9% $13
Silver 1-hour 918 33.8% 1.00 +0.8% −35.7% −5.3% +6.4% −40.2% $4,204
Silver 4-hour 225 39.1% 1.32 +23.1% −9.7% +7.2% +14.9% −16.4% $464
Silver daily 38 26.3% 1.77 +13.7% −6.8% −2.2% +16.3% −10.9% $40
S&P 500 1-hour 1,021 34.7% 0.91 −33.3% −44.0% −7.2% −28.2% −55.6% $992
S&P 500 4-hour 247 36.4% 0.85 −13.6% −24.2% −16.7% +3.7% −28.4% $100
S&P 500 daily 41 48.8% 0.94 −0.7% −4.8% −2.7% +2.0% −6.9% $6
Nasdaq 100 1-hour 1,004 33.4% 0.86 −41.5% −44.3% −27.4% −19.4% −54.8% $702
Nasdaq 100 4-hour 247 37.7% 0.87 −9.8% −14.4% −9.0% −0.8% −23.4% $74
Nasdaq 100 daily 36 47.2% 1.72 +7.6% −2.5% +1.0% +6.5% −5.2% $6
DAX 1-hour 952 35.3% 1.05 +16.8% −33.3% −18.1% +42.6% −38.4% $541
DAX 4-hour 247 32.4% 0.94 −5.6% −19.7% −6.1% +0.6% −28.8% $58
DAX daily 49 22.4% 0.49 −12.0% −12.6% −5.3% −7.1% −16.7% $6
FTSE 100 1-hour 974 29.8% 0.84 −51.4% −60.2% −26.9% −33.5% −63.2% $1,121
FTSE 100 4-hour 237 36.7% 1.08 +6.7% −12.0% −7.5% +15.3% −17.1% $163
FTSE 100 daily 49 28.6% 0.49 −8.5% −10.3% −3.4% −5.3% −12.4% $12

Profit factor is the money won divided by the money lost. Above 1 means the test made money. Max drawdown is the biggest fall from the highest balance. 2019–2022 and 2023–2025 show the result in each period on its own. Monte Carlo drawdown: we shuffled the trades into a random order 1,000 times; in 95% of those runs, the worst drawdown was this number or less. Result is the change in the account, with the risk of each trade set to 1% of the account at that time.

The account balance

The best test and the middle test

Best test USD/JPY, 1-hour chart +101.6% from 2019 to 2025
Middle test (median): half of the 30 did better, half did worse USD/JPY, 4-hour chart −2.2% from 2019 to 2025

What we found

What the 30 backtests show

  1. Gold and silver were the only markets where the 20-candle breakout made money on every chart, from 2019 to 2025: gold +93.4% (1-hour), +22.7% (4-hour) and +11.0% (daily), and silver +0.8% (1-hour), +23.1% (4-hour) and +13.7% (daily). Both metals rose a lot in these years: gold from about $1,300 an ounce to over $4,300. But on the silver 1-hour chart, the trades made $4,287 before trading costs, and the costs were $4,204, so the test made almost nothing: +0.8% (see 'Trading costs on each market' further down). Of the 30 tests from 2019 to 2025, the 4-hour tests of gold and silver were the only ones that passed all four of our checks. Gold's daily test from 2005 to 2025 passed them too (see 'The four-week rule on daily charts, from 2005 to 2025' below).

  2. On 1-hour charts, USD/JPY was the best test: +101.6%, with +62.8% in 2019–2022 and +23.9% in 2023–2025. The second period starts from the balance at the end of the first, so the two results don't add up to the total. GBP/JPY (+8.6%) also made money in both periods. The DAX made +16.8% overall, but not in both periods: −18.1% in 2019–2022 and +42.6% in 2023–2025. The 1-hour tests also had big drops in the account: in each 1-hour test, the max drawdown (the biggest fall from the highest balance) was between 18.0% and 60.2%. We shuffled the trades of each test into a random order 1,000 times. In every 1-hour test, the worst 5% of these shuffles had a drawdown of 31.3% or more, above our limit of 30%. So no 1-hour test passed all four of our checks.

  3. The breakout lost money on EUR/USD and GBP/USD on all 3 charts, from −2.7% to −27.1%. Both pairs ended 2025 within 7% of where they started in 2019. It also lost money on the S&P 500 and the Nasdaq 100 on 1-hour and 4-hour charts, from −9.8% to −41.5%, even though the two indices rose 173% and 298% from 2019 to 2025. Because the rules stop and reverse, a close below the channel turned a buy into a sell, so on these two indices the rules held a sell 36% to 42% of the time on 1-hour and 4-hour charts. On daily charts, where the channel is wider, it was 28% to 31% of the time.

  4. Because the rules stop and reverse, a trade was open 85% to 97% of the time, and most trades (79% to 84% on each chart) did not end at the stop-loss. They ended at a close beyond the other side of the channel, which moves with the price. R is 1% of the account: the amount a trade is set up to lose if it hits the stop-loss. After trading costs, the trades that ended at a close beyond the channel made +0.23R on average on 1-hour charts, +0.15R on 4-hour charts and +0.05R on daily charts. The trades that hit the stop-loss lost 0.79R to 0.87R on average, less than 1R. Most of them were reversals, which opened one candle after their breakout candle, usually closer to the stop-loss, and the trade size is rounded down to a size the market allows. All 12,647 trades together made +31.2R, less than 0.01R per trade.

  5. On daily charts, the chart the four-week rule was made for, each daily test made only 36 to 52 trades from 2019 to 2025, fewer than the 100 we need to judge one test. 4 of the 10 daily tests made money: silver (+13.7%), gold (+11.0%), the Nasdaq 100 (+7.6%) and USD/JPY (+3.0%). On a daily chart, the channel is wide, so the stop-loss is far from the entry. A trade risking only 1% of a $10,000 account would often be smaller than the smallest trade size the market allows. So on gold, silver, the Nasdaq 100 and the DAX, 45% to 63% of the daily trades used that smallest size, which risked more than 1% (see 'Smallest trade size' further down). From 2005 to 2025, on 4 currency pairs and gold, the daily rules made 128 to 149 trades per market. They made money on 4 of the 5, but only a little (see 'The four-week rule on daily charts, from 2005 to 2025' below).

Channel length

10, 20 or 55 candles: the results on each chart

We ran the same rules with a 10-candle and a 55-candle channel, on the same 10 markets and charts, from 2019 to 2025. Each cell shows three things: how many of the 10 tests made money after trading costs, the middle test's result (half of the 10 tests did better, half did worse), and the number of trades per test.

Channel 1-hour charts 4-hour charts Daily charts
10 candles 5 of 10 made money. Middle test +7.0%. 1,678 to 2,039 trades per test. 6 of 10 made money. Middle test +6.6%. 415 to 454 trades per test. 3 of 10 made money. Middle test −6.5%. 69 to 86 trades per test.
20 candles (the standard rules) 5 of 10 made money. Middle test −1.0%. 918 to 1,036 trades per test. 4 of 10 made money. Middle test −3.9%. 223 to 255 trades per test. 4 of 10 made money. Middle test −2.3%. 36 to 52 trades per test.
55 candles 4 of 10 made money. Middle test −7.2%. 358 to 417 trades per test. 5 of 10 made money. Middle test −0.2%. 88 to 120 trades per test. 6 of 10 made money. Middle test +0.7%. 9 to 17 trades per test.

On the S&P 500 and the Nasdaq 100, the 10-candle channel made money on 1-hour charts, where the 20-candle channel lost, but most of those gains came in 2019–2022. S&P 500: +79.5% in 2019–2022, then −10.7% in 2023–2025. Nasdaq 100: +76.3%, then +11.2%. In 2023–2025, the 20-candle channel made money in more tests than either of the other two lengths, on every chart. On daily charts, every test had fewer than 100 trades, and the 55-candle channel made only 9 to 17 trades per test in 7 years, too few to judge.

The daily chart since 2005

The four-week rule on daily charts, from 2005 to 2025

The daily tests above have fewer than 100 trades each. So we ran the same 20-candle rules on daily charts from January 2005 to December 2025, on the 5 markets of our test with price data from 2005: EUR/USD, GBP/USD, USD/JPY, GBP/JPY and gold. Each result is the change in the account during those years, after trading costs. We split the 21 years at 2014, to see whether the rules kept working in the second part.

Market Trades 2005–2013 2014–2025 2005–2025
EUR/USD 128 +6.2% +4.3% +10.7%
GBP/USD 149 −5.8% −3.6% −9.2%
USD/JPY 128 −0.2% +1.0% +0.8%
GBP/JPY 128 +5.2% −2.6% +2.4%
Gold 128 +8.1% +11.1% +20.1%

4 of the 5 markets made money from 2005 to 2025, but only a little: on gold, the best of the 5, the account grew less than 1% a year. Gold's test passed all four of our checks, with 2005–2013 and 2014–2025 as the two periods: 128 trades, money made in both periods, a profit factor of 1.43 in 2014–2025 and a Monte Carlo drawdown of 12.7%. EUR/USD also made money in both periods, but its profit factor in 2014–2025 was 1.17, below our 1.2. The second period starts from the balance at the end of the first, so the two results don't add up to the total. On gold, 28 of the 128 trades used the smallest trade size, and 3 breakouts were skipped (see 'Smallest trade size' further down). These are separate backtests from the ones in 'Results on every market': they start in January 2005, so by 2019 the account is a different size. From 2019 on, they make almost the same trades, with different trade sizes.

The strategy

What the Donchian channel breakout is

A Donchian channel is an indicator made of three lines. The upper line is the highest high of the last 20 candles. The lower line is the lowest low of the last 20 candles. The middle line is halfway between them. The channel is named after Richard Donchian, an American trader who started one of the first public commodity funds. His 'four-week rule' buys when price rises above the highest price of the last four weeks, and sells short when it falls below the lowest price of the last four weeks. On a daily chart, four weeks are about 20 trading days, so traders use a 20-candle channel. The rule is 'stop and reverse': the breakout that closes a buy also opens a sell, and the breakout that closes a sell also opens a buy. So a trade is almost always open. There is no take-profit. We tested a version of the four-week rule on daily charts, and the same 20-candle rules on 1-hour and 4-hour charts, which many traders use. In our version, a candle must close beyond the channel. Donchian's own rule used any price beyond the four-week high or low, so his trades could open before the candle closed.

Channel
20 candles: the highest high and the lowest low of the 20 candles before the current one
Entry
A candle closes above the channel (buy) or below it (sell short). The trade opens at the next candle's open.
Exit
A close beyond the other side of the channel, which also opens a trade the other way (stop and reverse), or the stop-loss
Stop-loss
The other side of the channel on the breakout candle. It does not move.
Take-profit
None
Trading costs on each market
Each trade pays the market's spread, the gap between the buy and the sell price. We used: EUR/USD 0.8 pips, GBP/USD 1.2 pips, USD/JPY 0.9 pips, GBP/JPY 2.5 pips, gold $0.30 an ounce, silver $0.020 an ounce, the S&P 500 0.4 points, the Nasdaq 100 1.5 points, the DAX 1.0 point and the FTSE 100 1.0 point. A pip is a price move of 0.0001 on EUR/USD and GBP/USD, and of 0.01 on USD/JPY and GBP/JPY. For silver, the Nasdaq 100, the DAX and the FTSE 100, we used wider spreads than our backtest engine's own, to match a typical retail broker.
Risk per trade
1% of the account. The size is set on the breakout candle, from its close to the stop-loss. A trade that opens one candle after its breakout candle (a reversal) can risk more or less than 1%, because price moves during that candle.
Smallest trade size
When a trade that risks 1% would be smaller than the smallest trade size the market allows (0.1 of an index contract, which is 0.10 of a dollar, euro or pound for each point the index moves; 1 ounce of gold; 50 ounces of silver; 1,000 units of a currency), the test uses the smallest size, but only if it risks no more than 2% of the account. In the 30 tests from 2019 to 2025: on a daily chart, the channel is wide, so the stop-loss is far from the entry. 93 of the 437 daily trades used the smallest size, and on gold, silver, the Nasdaq 100 and the DAX, 45% to 63% of the daily trades used it. On 1-hour and 4-hour charts, 65 of the 12,210 trades used the smallest size. The test skipped 30 breakouts, because even the smallest size would have risked more than 2%: 20 on daily charts, and 10 on 1-hour and 4-hour charts.
Overnight (swap) fees
Not included. Brokers charge (or sometimes pay) a fee for each night a trade stays open. With these rules, a trade was open 85% to 97% of the time. Half of the trades stayed open longer than 1.8 days on 1-hour charts, 7.7 days on 4-hour charts and 41 days on daily charts. So with a real broker, the results could be higher or lower.

The rules we tested

  1. The channel is the highest high and the lowest low of the 20 candles before the current candle. A candle with no price movement at all, which is a market holiday in our price data, does not count. We check each candle when it closes, and a trade opens at the next candle's open.
  2. Buy when a candle closes above the channel, that is, above the highest high of the 20 candles before it.
  3. Sell short when a candle closes below the channel, below the lowest low of the 20 candles before it. Selling short means you sell first and buy back later, so the trade makes money if the price falls.
  4. Stop and reverse: a buy stays open until a candle closes below the channel, or until the stop-loss is hit. A candle that closes below the channel closes the buy and is the signal for a sell. In the same way, a candle that closes above the channel closes a sell and is the signal for a buy. In our test, the old trade closes at the next candle's open, and the new trade opens one candle later, because the backtest can only open the new trade once the old one has closed. After a stop-loss, the next trade opens at the next close beyond the channel, in either direction.
  5. Put the stop-loss at the other side of the channel on the breakout candle: at the 20-candle low for a buy, and at the 20-candle high for a sell. It does not move.
  6. Size every trade so that, if the stop-loss is hit, the trade loses 1% of the account, measured from the close of the breakout candle. If that trade is smaller than the smallest trade size the market allows, use the smallest size, but only if it loses no more than 2% of the account at the stop-loss. Otherwise, skip the trade.

The method

How we tested it

The test

Markets
EUR/USD, GBP/USD, USD/JPY, GBP/JPY, Gold, Silver, S&P 500, Nasdaq 100, DAX and FTSE 100
Charts
1-hour, 4-hour and daily candles
Dates
January 2019 to December 2025
Account
$10,000, risking 1% of the account on each trade
Trading costs
Included. Every trade pays that market's normal trading cost: the spread, which is the gap between the buy price and the sell price.

How a test passes

We call a test passed only if it meets all four checks. A strategy can make money in one backtest and still fail one of these checks.

  • At least 100 trades. With fewer trades, a good result could be luck.
  • It made money from 2019 to 2022 and again from 2023 to 2025. This shows whether the strategy kept working in the newer years, not only in the older ones.
  • A profit factor (the money won divided by the money lost) of at least 1.2 from 2023 to 2025, after trading costs.
  • In 95% of 1,000 random shuffles of the trades, the account must not fall more than 30% from its highest point.

Improvements

Can the Donchian channel breakout be improved?

Traders change the Donchian breakout in a few common ways: a faster or a slower channel, an earlier exit at the middle line, or a trend filter. We tested 4 of these changes, each on the same 10 markets and 3 charts (30 backtests each). If you pick the best version and judge it on the same years, it will almost always look good. So we picked the best one using 2019–2022 only, by the number of tests that made money. Then we checked it on 2023–2025, the years we did not use to pick it.

Version Made money 2019–2022years used to pick the best version Made money 2023–2025years not used to pick it Made money in both periods Passed all four checks
Standard rules: a 20-candle channel, stop and reverse The rules under 'The rules we tested', with nothing changed. 10 of 30middle test −1.8% 16 of 30middle test +1.3% 5 2
A 10-candle channel The same rules with a faster channel: the highest high and the lowest low of the last 10 candles. The breakout, the reversal and the stop-loss all use the 10-candle channel, so the stop-loss is closer and there are about twice as many trades. 15 of 30middle test −0.8% 11 of 30middle test −2.9% 6 1
A 55-candle channel A slower channel: the last 55 candles. The Turtle traders, a well-known group of trend traders from the 1980s, used 55 days for their slower system. The stop-loss is further away and there are fewer trades: on daily charts, only 9 to 17 per market from 2019 to 2025. 12 of 30middle test −0.6% 10 of 30middle test −1.1% 1 1
An exit at the middle line Close the trade when a candle closes on the other side of the middle line of the channel, halfway between the 20-candle high and low: below it for a buy, above it for a sell. The stop-loss stays the same. There is no reversal: after the exit, wait for the next breakout. So a trade was open only 51% to 72% of the time, compared with 85% to 97% with the standard rules. 14 of 30middle test −0.1% 13 of 30middle test −1.1% 6 4
With a 200-candle moving average filterBest on 2019–2022 The 200 SMA (simple moving average) is the average closing price of the last 200 candles. Only buy when the breakout candle closes above it, and only sell short when the breakout candle closes below it. The stop-loss stays the same. A close beyond the channel still closes a trade, but the new trade the other way opens only if the filter allows it. On daily charts, the 200 SMA needs 200 candles, so this version could not trade before October 2019. 16 of 30middle test +0.9% 13 of 30middle test −1.0% 4 3

None of the 4 changes made money in more tests than the standard rules in 2023–2025. The 200 SMA filter did best in 2019–2022, the years we used to pick the best version: 16 of 30 tests made money with it, compared with 10 with the standard rules. In 2023–2025, the years we did not use to pick it, it made money in 13 of 30 tests, compared with 16 with the standard rules. The filter blocked many of the sells on the stock indices, which rose a lot from 2019 to 2025: on the S&P 500 1-hour chart, the result was −4.7% with the filter, compared with −33.3% with the standard rules. With the exit at the middle line, 14 of 30 tests made money in 2019–2022 and 13 in 2023–2025. 4 of its tests passed all four of our checks: USD/JPY and the DAX on 1-hour charts, and gold and silver on 4-hour charts. With the standard rules, 2 passed. So the middle-line exit passed more tests, but it made money in fewer tests in 2023–2025: 13, compared with 16. On 1-hour charts, the 10-candle channel did better than the standard rules on 4 of the 10 markets (USD/JPY, the S&P 500, the Nasdaq 100 and the DAX) and worse on the other 6. The 55-candle channel made the fewest trades, and it did worst in 2023–2025: 10 of 30 tests made money.

Passed all four checks with a 200-candle moving average filter

  • Gold, 1-hour
  • Gold, 4-hour
  • Silver, 4-hour

Questions

Questions traders ask

Does the Donchian channel breakout work?

Mostly no, in our backtest. All 12,647 trades from 2019 to 2025 together made almost nothing: less than 0.01R per trade, where R is 1% of the account. From 2019 to 2025, after trading costs, the standard 20-candle breakout made money on gold and silver on every chart we tested (1-hour, 4-hour and daily). The best backtest was USD/JPY on the 1-hour chart: +101.6%. The strategy lost money on EUR/USD, GBP/USD and the S&P 500 on every chart. Of the 30 tests from 2019 to 2025, only the 4-hour tests of gold and silver passed all four of our checks. The checks are: at least 100 trades; money made in both 2019–2022 and 2023–2025; a profit factor (the money won divided by the money lost) of at least 1.2 in 2023–2025; and a drawdown (a fall from the highest balance) under 30% in 95% of 1,000 random shuffles of the trades. Gold's daily test from 2005 to 2025 passed the same four checks, with 2005–2013 and 2014–2025 as the two periods, but the account grew only 20.1% in 21 years.

What are the best Donchian channel settings?

From 2019 to 2025 as a whole, no channel length was best on every chart. We tested channels of 10, 20 and 55 candles on the same 10 markets. On 1-hour charts, the 10-candle and the 20-candle channels each made money in 5 of 10 tests, and the 55-candle channel in 4. On 4-hour charts, 10 candles made money in 6 of 10 tests, 55 candles in 5 and 20 candles in 4. But in 2023–2025, the standard 20-candle channel made money in more tests than either of the other two lengths, on every chart. Be careful with a setting chosen because it gave the best backtest: it fits the past, so it often does worse in later years.

What is the best timeframe for the Donchian channel breakout?

No timeframe (chart) made money on most markets in our backtest. On 1-hour charts, 5 of 10 tests made money, including the best of all 30 tests (USD/JPY, +101.6%), but in each 1-hour test, the max drawdown (the biggest fall from the highest balance) was between 18.0% and 60.2%. On 4-hour charts, 4 of 10 made money, and of the 30 tests from 2019 to 2025, the 4-hour tests of gold and silver were the only ones that passed all four of our checks. On daily charts, the chart the four-week rule was made for, each daily test made only 36 to 52 trades from 2019 to 2025, fewer than the 100 we need to judge one test. From 2005 to 2025, gold's daily test made 128 trades and passed all four checks, but the account grew only 20.1% in 21 years.

Does Donchian's four-week rule still work?

Only a little, in our backtest. The four-week rule buys when price rises above the highest price of the last four weeks (20 trading days), and sells short when it falls below the lowest price of the last four weeks. On daily charts from 2005 to 2025, it made money on 4 of the 5 markets we tested: gold (+20.1%, less than 1% a year), EUR/USD (+10.7%), GBP/JPY (+2.4%) and USD/JPY (+0.8%). GBP/USD lost 9.2%. In 2014–2025, it made money on gold (+11.1%), EUR/USD (+4.3%) and USD/JPY (+1.0%). Each of these 5 tests made 128 to 149 trades, and gold's test passed all four of our checks.

Keep exploring

Related strategies we tested

Turtle trading Turtle Trading System 1 (20/10) backtest Made money in 7 of 10 tests, 4 of them in both periods. Best: Silver, daily, +29%
The strategy code we ran

This is the exact code from the BacktestingMax strategy engine. Paste it into the strategy editor in the app to run it on any market.

class DonchianChannelBreakout(Strategy):
    """Donchian's four-week rule: a 20-candle channel breakout that is always in the market
    (stop and reverse), plus three changes traders often make.
    The channel is the highest high and the lowest low of the 20 candles before the current
    one. A candle with no price movement at all (its high equals its low: a market holiday or
    a closed hour in the price data) does not count, and the rules do nothing on it.
    Standard (all switches off): buy when a candle closes above the channel, sell short when a
    candle closes below it. The stop-loss is the other side of the channel on that breakout
    candle (the 20-candle low for a buy, the 20-candle high for a sell); it does not move. The
    size is set on the breakout candle too, so that the stop-loss costs 1% of the account from
    that candle's close.
    A buy stays open until a candle closes below the channel: that candle closes the buy (at
    the next candle's open) and is the breakout for a sell. The engine fills one order per
    candle, so the sell opens one candle later, with the stop-loss and size set on the
    breakout candle. A sell reverses into a buy the same way.
    Trade size: when 1% of the account is less than the smallest trade size the market allows
    (0.1 of an index contract, 1 ounce of gold, 50 ounces of silver, 1,000 currency units), the
    trade uses that smallest size if it risks no more than 2% of the account. Otherwise it is
    skipped.
    The changes, one at a time:
      length       = 10 or 55   a faster or a slower channel; the breakout, the reversal and
                                the stop-loss all use that length
      mid_exit     = 1          close the trade when a candle closes back beyond the middle
                                line of the channel (halfway between its high and its low);
                                no reversal: wait for the next breakout
      trend_filter = 1          only buy when the breakout candle closes above the 200 SMA,
                                only sell short when it closes below it
    """
    params = {"length": Param(type=int, default=20, min=2, max=300),
              "mid_exit": Param(type=int, default=0, min=0, max=1),
              "trend_filter": Param(type=int, default=0, min=0, max=1)}
    lookback = 220
    def init(self, ctx):
        self.sma = ctx.indicator("builtin:sma", period=200)
        self.highs = []  # the highs and lows of the last candles that traded, oldest first
        self.lows = []
        self.pending = None  # (side, stop, size): the reversal to open once the old trade is gone
    def order_for(self, ctx, side, stop):
        """The trade a breakout on this candle asks for, or None: (side, stop, size)."""
        close = ctx.close[0]
        if ctx.params.trend_filter == 1:
            ma = self.sma.sma[0]
            if ma is None or (side == "long" and close <= ma) or (side == "short" and close >= ma):
                return None
        if (side == "long" and stop >= close) or (side == "short" and stop <= close):
            return None
        size = ctx.size_by_risk_pct(0.01, stop=stop, entry=close)
        if size <= 0:
            # 1% is less than the smallest trade size: take the smallest size if it risks
            # no more than 2% of the account (on these markets the 2% size rounds down to it).
            size = ctx.size_by_risk_pct(0.02, stop=stop, entry=close)
        if size <= 0:
            return None
        return (side, stop, size)
    def on_bar(self, ctx):
        n = ctx.params.length
        # The channel of the n candles before this one, then the same with this candle in it.
        full = len(self.highs) == n
        up = max(self.highs) if full else None
        lo = min(self.lows) if full else None
        high, low = ctx.high[0], ctx.low[0]
        traded = high > low  # no price movement at all: a holiday or a closed hour
        if traded:
            self.highs.append(high)
            self.lows.append(low)
            if len(self.highs) > n:
                self.highs.pop(0)
                self.lows.pop(0)
        if up is None or not traded:
            return
        up0, lo0 = max(self.highs), min(self.lows)
        close = ctx.close[0]
        breakout_up = close > up     # closed above the highest high of the previous candles
        breakout_down = close < lo   # closed below the lowest low of the previous candles
        pos = ctx.position
        if pos is not None:
            if ctx.params.mid_exit == 1:
                mid = (up + lo) / 2
                if (pos.is_long and close < mid) or (pos.is_short and close > mid):
                    ctx.close_position()
                return
            if pos.is_long and breakout_down:
                ctx.close_position()
                self.pending = self.order_for(ctx, "short", up0)
            elif pos.is_short and breakout_up:
                ctx.close_position()
                self.pending = self.order_for(ctx, "long", lo0)
            return
        # A reversal set on the previous candle opens now, unless price broke out the other way.
        pending, self.pending = self.pending, None
        if pending is not None and ((pending[0] == "long" and breakout_down)
                                    or (pending[0] == "short" and breakout_up)):
            pending = None
        if not ctx.gate("channel_breakout", pending is not None or breakout_up or breakout_down):
            return
        order = pending
        if order is None:
            order = self.order_for(ctx, "long", lo0) if breakout_up else self.order_for(ctx, "short", up0)
        if order is None:
            return
        side, stop, size = order
        if side == "long":
            ctx.buy(size=size, sl=stop, tag="donchian_long")
        else:
            ctx.sell(size=size, sl=stop, tag="donchian_short")

Your turn

Test the Donchian channel breakout yourself

Change the settings, the market or the stop-loss and see the result in seconds. Ask the BacktestingMax AI: Backtest a 20-candle Donchian channel breakout with stop and reverse on gold, 4-hour chart, from 2019 to 2025: buy when a candle closes above the 20-candle high, sell short when it closes below the 20-candle low, stop-loss at the other side of the channel, 1% risk per trade.

Try it free in BacktestingMax

Free account. No credit card needed.

See every strategy we tested Browse strategies shared by traders

Backtest on historical data with trading costs, run by BacktestingMax. Past results do not guarantee future results, and nothing here is financial advice. Updated 19 October 2026.