Join waitlist
Strategies / Trend / Donchian Trend EMA Crossover

Donchian Trend EMA Crossover

The system buys when a fast EMA of a 42-bar Donchian trend line crosses above its slow EMA with the close above the 200-period EMA, and shorts the mirror setup. Positions close on opposing crosses or on the trend line crossing zero.

TrendLong & shortSwingGBP/USDDaily
n/aProfit factor
12,118Net profit USD
29.92%Win rate
732Trades
-6,402Max drawdown
16.55Avg trade

Best run of 6. GBP/USD, Daily, spread 1.5, from run sweeps:2026-10-12-GBPUSD-D-opt.tsv:5.

Entry rules, long

  1. Alternatively, the close crosses above the 200-period EMA.

Entry rules, short

  1. Alternatively, the close crosses below the 200-period EMA.

Exit rules

  1. A long also closes when the 5-period EMA of the close crosses under 1.05, 1.10 or 1.15 times the last long entry close.
  2. A long closes when the trend line crosses below zero.
  3. Short exits mirror these conditions, using 0.95, 0.90 and 0.85 times the last short entry close.

Test conditions

PeriodUp to 2026-10-12
InstrumentGBP/USD, Daily
Spread1.5 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-12

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GBP/USDBest runDailyn/a 73229.9212,118 USD-6,402
USD/JPYDailyn/a 70428.411,637,140 USD-740,740
EUR/USDDailyn/a 64629.5789,361 USD-31,818
Nikkei 225Dailyn/a 62132.3724,586 USD-11,834
Nasdaq 100Dailyn/a 55829.393,997 EUR-3,929
GoldDailyn/a 70730.411,653 EUR-1,235

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Donchian Trend EMA Crossover
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: Daily
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE buyzero = 0
ONCE sellzero = 0

upper = highest[42](high)
lower = lowest[42](low)
dontrend = -((upper - close) + (lower - close))
xup = highest[42](dontrend)
xdown = lowest[42](dontrend)
dragon = (xup[1] + xdown[1]) / 2

emax = ExponentialAverage[5](dontrend)
emin = ExponentialAverage[45](dontrend)
ematrf = ExponentialAverage[200](close)

myMacd = ExponentialAverage[5](close) - ExponentialAverage[45](close)
signal = ExponentialAverage[5](myMacd)

55 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 ChannelEMAMACD
Read this firstKnown weaknesses3 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 6,402 USD is large next to the net profit of 12,118 USD.
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.

Questions

About this strategy

Can I run Donchian Trend EMA Crossover 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 6 market and timeframe combinations. The best run by trade count was GBP/USD, Daily, with 732 trades.

How large was the drawdown?

The best run had a maximum drawdown of 6,402 USD at the tested position size, against a net result of 12,118 USD.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Slow MACD Slope

Uses the same indicator.

6.80 PF · 7,305 trades

Color Code Candle Flip

Best run on the same market, GBP/USD.

1.56 PF · 3,285 trades

ADX Filtered EMA Cross

Also a trend strategy.

1.15 PF · 607 trades

Get the full rules, the complete code and the ProRealAlgos portfolio as a member.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

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