Join waitlist
Strategies / Trend / Donchian Midline Cross With ATR Stop

Donchian Midline Cross With ATR Stop

The system buys when the close crosses above the midpoint of the 40-bar Donchian channel and sells short when it crosses below. Each trade has a stop 3.0 times the 14-period ATR away and a target at the distance to the opposite channel edge.

TrendLong & shortIntradayNasdaq 10030 min
25.61Profit factor
28,480Net profit EUR
58.21%Win rate
134Trades
-6,277Max drawdown
213Avg trade

Best run of 8. Nasdaq 100, 30 min, spread 3, from run pf:2026-10-05-NAS100-30m.tsv:4.

Entry rules, long

  1. The close crosses above the midpoint of the 40-bar high and low range.

Entry rules, short

  1. The close crosses below the midpoint of the 40-bar high and low range.

Exit rules

  1. The long target is the distance from the signal close to the 40-bar highest high.
  2. The short target is the distance from the signal close to the 40-bar lowest low.

Test conditions

PeriodUp to 2026-10-05
InstrumentNasdaq 100, 30 minutes
Spread3 points
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-10-10

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
Nasdaq 100Best run30 min25.61 13458.2128,480 EUR-6,277
Nikkei 2251 hour10.75 12955.8160,424 USD-12,691
S&P 50030 min3.89 46250.435,654 EUR-1,319
SilverDailyn/a 23056.0924,471 USD-15,862
Dow Jones4 hoursn/a 23862.1813,370 EUR-5,753
Dow JonesDailyn/a 30859.4213,039 EUR-7,610
Brent Crude1 hourn/a 1,41857.909,426 EUR-2,402
Brent CrudeDailyn/a 10157.436,823 EUR-5,328

Charts

Results by run

Above 1.0 made money, below 1.0 lost money.

The code

ProBuilder code, as tested

// ==============================================================
// Donchian Midline Cross With ATR Stop
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 30 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

up = Highest[40](high)
dn = Lowest[40](low)
basis = (up + dn) / 2
myAtr = AverageTrueRange[14](close)
sldist = myAtr * 3.0
longtp = up - close
shorttp = close - dn

15 more lines: the entry and exit rules.

Setup

How to load it

  1. Copy the code with the copy button on the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Indicators used

Donchian ChannelATR
Read this firstKnown weaknesses2 points
  • Results include the spread only. Commissions and overnight financing are not included.
  • The code is published as it was backtested and has not been compiled again since.

Questions

About this strategy

Can I run Donchian Midline Cross With ATR Stop in ProOrder?

Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.

Which markets was it tested on?

It was tested on 8 market and timeframe combinations. The best run was Nasdaq 100, 30 minutes, with a profit factor of 25.61 over 134 trades.

How large was the drawdown?

The best run had a maximum drawdown of 6,277 EUR at the tested position size, against a net result of 28,480 EUR.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Turtle Trade

Uses the same indicator.

2.42 PF · 6,324 trades

Volatility Spike Regression Long

Best run on the same market, Nasdaq 100.

1.22 PF · 1,850 trades

DMI Threshold Cross With ATR Stop

Also a trend strategy.

24.44 PF · 242 trades

See how ProRealAlgos combines strategies like this into one automated portfolio.

Copy trading on US indices is available to ProRealAlgos members as spots open.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs