Skip to content
ViprasolWE SOLVE INFINITYGet started
Back to Blog

Donchian Channel Breakouts: Turtle Rules on Modern Markets

What the Donchian indicator plots, how the original turtle rules used it for entries, exits and position size, and what changes on today's markets.

Viprasol Tech Team
12 min read
Updated 2026

Donchian Channel Breakouts: Turtle Rules on Modern Markets

TLDR

The Donchian indicator plots the highest high and lowest low of the last N bars as a channel around price. A Donchian breakout system buys when price exceeds the upper channel and sells or exits when it drops below a shorter lower channel; it is the engine behind the turtle trading rules of the 1980s, which paired a 20-day or 55-day entry channel with a 10-day or 20-day exit channel, a stop of two ATR units and position sizing by volatility. The rules still work as a definition, but the raw version suffers in modern markets from more frequent false breakouts, lower trend persistence in some asset classes and higher relative costs on short lookbacks. This article explains the indicator, states the classic rules precisely, works the arithmetic for one trade, gives an original Pine Script v6 implementation and lists the adaptations worth testing.

What the Donchian indicator plots

Richard Donchian, who ran one of the first managed futures funds, is credited with the channel that carries his name. The construction is as simple as an indicator gets:

  • Upper channel = highest high of the previous N bars
  • Lower channel = lowest low of the previous N bars
  • Middle line = average of the two (optional)

A detail that matters for honesty: the channel used for a signal should be computed over the bars before the current one, so that today's high is not included in the level today's high is being compared against. If you include the current bar, the upper channel can never be exceeded, only touched. Most charting platforms plot the inclusive version for display and leave the exclusive version to the strategy logic. The code later in this article uses the exclusive version explicitly.

Unlike moving averages, the channel is a step function: it only changes when a new extreme enters or an old one leaves the lookback window. That makes the breakout level flat and visible for bars at a time, which is one reason Donchian systems are easy to execute mechanically with stop orders.

The classic turtle rules, stated precisely

The turtle rules were taught by Richard Dennis and William Eckhardt to a group of trainees in 1983 and 1984, and were later published by one of those trainees, Curtis Faith, in a freely distributed document titled The Original Turtle Trading Rules. The version below follows that document; where we simplify, we say so.

Volatility unit

N is a 20-day exponential-style average of true range (the document describes a specific recursive smoothing; a 20-period ATR is a close substitute). One unit of position is the number of contracts such that a 1 N move equals 1 percent of account equity:

Unit = (0.01 x account) / (N x dollars per point)

Entries

  • System 1: enter on a break of the 20-day high (long) or 20-day low (short). A System 1 signal is skipped if the previous System 1 breakout on that market would have been a winning trade; the skipped trade is still tracked so the filter can be applied to the next one.
  • System 2: enter on a break of the 55-day high or low. No skip filter.

Adding to positions

After the first unit, add one unit each time price moves 0.5 N in the trade's favor, up to a maximum of 4 units in a single market. The stop for all units moves to 2 N below the most recent fill.

Stops

Initial stop at 2 N from the entry price. With a 1 percent unit size, a 2 N stop risks about 2 percent of equity per unit before adds.

Exits

  • System 1: exit longs on a 10-day low, shorts on a 10-day high.
  • System 2: exit longs on a 20-day low, shorts on a 20-day high.

Exits were executed intraday as price touched the level, not on the close. The turtles also had portfolio-level limits on total units across correlated markets, which this article does not cover.

Entry and exit lengths compared

VariantEntry channelExit channelTrades per year per market (qualitative)BehaviorMain weakness
Turtle System 120 bars10 barsManyCatches most trends early; exits quicklyHigh false-breakout count; the skip filter was the original mitigation
Turtle System 255 bars20 barsFewOnly major trends; holds through pullbacksLate entry; large giveback at the end of a trend
Symmetric 20 / 2020 bars20 barsFewer than System 1Always in the market when run long and shortReverses on every 20-bar extreme; whipsaws in ranges
Intraday 30 / 10 on 5 minute bars30 bars10 barsSeveral per dayShort-horizon momentum captureSpread and slippage dominate; needs a session filter

The counts are deliberately qualitative. Actual trade frequency depends on the instrument's volatility and trend persistence, and inventing a number here would be exactly the kind of statistic this site avoids.

Worked example: one System 1 trade in numbers

A trader runs System 1 on a gold futures contract with a 100-ounce multiplier, so one point of price equals 100 dollars. Account equity is 150,000. N, the 20-day ATR, is 28.0 points.

  • Unit size = (0.01 x 150,000) / (28.0 x 100) = 1,500 / 2,800 = 0.54 contracts, which rounds down to zero full contracts. This is the first lesson of the turtle math on a modern account: with a 150,000 account the full-size gold contract is too large for a 1 percent unit, so the trader must use the micro contract (10 ounces, 10 dollars per point).
  • Recomputed with the micro contract: 1,500 / (28.0 x 10) = 5.36, so 5 micro contracts per unit.

The 20-day high is 2,640.0. Price trades through it and the trader is filled at 2,641.5 (1.5 points of slippage on a stop order).

  • Initial stop = 2,641.5 - 2 x 28.0 = 2,585.5
  • Risk at the stop = 56.0 points x 10 dollars x 5 contracts = 2,800, or 1.87 percent of equity
  • First add level = 2,641.5 + 0.5 x 28.0 = 2,655.5. Fill at 2,656.0; stop for all units moves to 2,656.0 - 56.0 = 2,600.0

Suppose price rises to 2,720 over the next three weeks and then rolls over. The 10-day low eventually rises to 2,688.0 and price touches it. The exit for both units fills at 2,687.0.

  • Unit 1: (2,687.0 - 2,641.5) x 10 x 5 = 2,275
  • Unit 2: (2,687.0 - 2,656.0) x 10 x 5 = 1,550
  • Gross result before commissions: 3,825, about 2.55 percent of starting equity

Two observations. The trade gave back 33 points from the peak before the 10-day low was hit, which is normal for channel exits and is why the system needs trends that run well past the exit distance. And the position sizing did its job: the risk at the initial stop was under 2 percent, not because the trader chose a stop that felt right but because N set both the stop distance and the size. These numbers are constructed to show the arithmetic; they are not a backtest.

Original Pine Script v6: turtle-style Donchian breakout

The script below plots exclusive entry and exit channels, tracks a single position state with a 2 N stop, and marks entries and exits on confirmed bars. It is an indicator rather than a strategy so you can read the state logic; converting it to strategy.entry and strategy.exit is mechanical. The pyramid adds and the System 1 skip filter are left out to stay under the length limit; both are a few extra lines in a strategy version.

//@version=6
indicator("Donchian breakout (turtle-style)", overlay = true)

entryLen = input.int(20, "Entry channel length", minval = 1) exitLen = input.int(10, "Exit channel length", minval = 1) nLen = input.int(20, "N (ATR) length", minval = 1) stopN = input.float(2.0, "Stop distance in N", step = 0.5, minval = 0.5)

upper = ta.highest(high, entryLen)[1] lower = ta.lowest(low, entryLen)[1] exitLong = ta.lowest(low, exitLen)[1] exitShort = ta.highest(high, exitLen)[1] n = ta.atr(nLen)

var int pos = 0 var float entryPx = na var float stopPx = na

if barstate.isconfirmed if pos == 0 and close > upper pos := 1 entryPx := close stopPx := close - stopN * n else if pos == 0 and close < lower pos := -1 entryPx := close stopPx := close + stopN * n else if pos == 1 and (close < exitLong or close < stopPx) pos := 0 else if pos == -1 and (close > exitShort or close > stopPx) pos := 0

enterLong = pos == 1 and pos[1] != 1 enterShort = pos == -1 and pos[1] != -1 exitAny = pos == 0 and pos[1] != 0

plot(upper, "Entry high", color = color.new(color.green, 0)) plot(lower, "Entry low", color = color.new(color.red, 0)) plot(pos == 1 ? exitLong : pos == -1 ? exitShort : na, "Exit channel", color = color.orange, style = plot.style_linebr) plot(pos != 0 ? stopPx : na, "2N stop", color = color.gray, style = plot.style_linebr) bgcolor(pos == 1 ? color.new(color.green, 92) : pos == -1 ? color.new(color.red, 92) : na)

plotshape(enterLong, "Long entry", shape.triangleup, location.belowbar, color.green, size = size.small) plotshape(enterShort, "Short entry", shape.triangledown, location.abovebar, color.red, size = size.small) plotshape(exitAny, "Exit", shape.xcross, location.abovebar, color.gray, size = size.tiny) alertcondition(enterLong, "Donchian long", "Close above entry channel") alertcondition(enterShort, "Donchian short", "Close below entry channel") alertcondition(exitAny, "Donchian exit", "Exit channel or 2N stop hit")

Design notes:

  • The [1] on each channel makes it exclusive of the current bar, so a close above upper is a genuine break of the prior 20-bar high.
  • Signals use the close rather than an intraday touch. The original turtles entered on stop orders as price traded through the level. A close-based version enters later and avoids some false breaks; which is better on your market is a test, not a principle. The non-repainting indicators article explains why the close-based version is also the one you can trust in a backtest without tick data.
  • State changes happen only on confirmed bars, so the background and markers do not flicker on the live bar.
  • The stop is checked against the close. A strategy version would place a real stop order with strategy.exit and get the intrabar fill.

What changes on modern markets

The original rules were traded on a diversified portfolio of futures in the 1980s. Several things are different now, and each one suggests an adaptation to test rather than a reason to abandon the approach.

More false breakouts on short lookbacks

Electronic markets with deep liquidity tend to probe obvious levels and reverse more often than pit-traded markets did. The 20-day channel in particular is widely watched. Adaptations: require a close beyond the channel rather than a touch; require the break to exceed the channel by a fraction of N; or use the squeeze or range-contraction filter described in our TTM Squeeze article so that breakouts only count after a compression.

Costs relative to channel width

On daily bars in liquid futures, commissions and slippage are small compared with a 2 N stop. On a 5 minute chart the same rules produce a channel a few ticks wide and the spread becomes a large fraction of each trade's risk. If you run Donchian intraday, measure costs as a percentage of N and be suspicious of any backtest that assumes zero slippage on stop entries. The backtesting platforms comparison covers how each tester handles that.

Trend persistence varies by asset class

Channel breakouts need trends that run several N beyond the entry. Some markets, notably certain equity indices in strong bull phases, trend upward but mean-revert sharply on the short side; others, such as some currency pairs, spend long stretches in ranges. Running identical rules long and short on every market is the classic approach, and it is also where most of the drawdown comes from. Testing long-only, or with a higher-timeframe trend filter, is a reasonable modern adaptation.

Single-market versus portfolio

The turtle results depended on diversification: many markets, each trading rarely, with losses on most and large gains on a few. A retail trader running Donchian on one or two instruments gets the same per-market statistics without the smoothing. Expect longer flat periods and deeper drawdowns than the portfolio versions reported in books, and size for that.

The opening range as a short-horizon Donchian

An opening range breakout is a Donchian channel whose lookback is defined by the clock instead of a bar count: the high and low of the first 15 or 30 minutes. The ORB strategy article covers that variant in detail; the stop placement and filter ideas there carry over to any short-lookback channel system.

FAQ

What is the Donchian indicator used for?

Mainly for breakout entries and trailing exits in trend-following systems, and as a simple way to visualize the recent range. It is also used for position sizing indirectly, because the channel width is a volatility proxy.

Do the turtle trading rules still work?

The rules are a precise definition and they still define a trend-following system that participates in large moves. Whether that system is profitable after costs on a given market and period is an empirical question that depends heavily on the instrument set and the trend regime, and it is one you can answer for yourself with a backtest. We do not claim a result either way.

Donchian channel or Bollinger Bands for breakouts?

A Donchian channel is a hard level set by actual past prices, so a break is unambiguous and the level is visible in advance. Bollinger Bands are statistical envelopes that move every bar; a close outside the band can happen in a range without any structural break. For mechanical breakout entries, Donchian is simpler to execute and test. Bollinger width is more useful as a compression filter in front of a Donchian entry than as the entry itself.

What period should I use for the Donchian channel?

The classic pairs are 20 / 10 and 55 / 20 on daily bars. There is nothing special about those numbers; they were chosen in the 1980s and have been widely published since, which, if anything, makes them more crowded. Test a range of entry lengths and prefer a region where neighboring values behave similarly.

Can a Donchian breakout system be automated as an expert advisor?

Yes, and it is one of the cleaner systems to automate because every rule is defined on completed bars or on stop orders at known prices. The N-based position sizing, the 2 N stop and the exit channel all translate directly into MQL5. The parts that need care are the pyramid adds, which require tracking fill prices, and the System 1 skip filter, which requires simulating the trades you did not take.

Where Viprasol fits

Viprasol builds and tests channel breakout systems for TradingView and MetaTrader. A typical engagement starts with the rules as you want them, including adds, skip filters and session or trend gates, then a strategy version with realistic costs, then an indicator or expert advisor you own. Our backtesting and strategy development service covers the measurement work, including parameter sensitivity and out-of-sample checks, and the MT5 expert advisor development service covers the automated version with N-based sizing and server-side stops. Pricing is on the pricing page; describe the rule set you want tested through the contact form.

Risk disclaimer: trading futures, forex, CFDs and crypto involves substantial risk of loss. This article is educational and is not investment advice; the worked example is illustrative and does not indicate future performance.

donchian indicatordonchian channelturtle trading rulesbreakout strategytrend followingpine script v6atr position sizing

External Resources

Share this article:

About the Author

V

Viprasol Tech Team

Custom Software Development Specialists

The Viprasol Tech team specialises in algorithmic trading software, AI agent systems, and SaaS development. With 1000+ projects delivered across MT4/MT5 EAs, fintech platforms, and production AI systems, the team brings deep technical experience to every engagement.

MT4/MT5 EA DevelopmentAI Agent SystemsSaaS DevelopmentAlgorithmic Trading

Ready to Automate Your Trading?

Discuss a custom Expert Advisor with defined strategy rules, risk controls and a testing plan.

Free consultation • No commitment • Response within 24 hours

Viprasol · Trading Software

Need a custom EA or trading bot built?

We build MT4/MT5 Expert Advisors around your strategy, broker and risk requirements. Each project has an agreed scope, testing plan and individual quote.