The idea buys when price closes above a 9 period EMA while +DI(14) is above 20 and above -DI(14). It sells the long when price closes below the EMA while -DI(14) is above 20 and above +DI(14).
Best run of 17. Gold, 1 hour, spread 0.6, from run sweeps:2026-10-04-GOLD-1h-opt.tsv:21.
| Period | Up to 2026-10-04 |
| Instrument | Gold, 1 hour |
| Spread | 0.6 points |
| Starting capital | 1,000,000 |
| Costs | Spread only. Commissions and overnight financing are not included. |
| Bars | Up to 200,000 bars, fewer where the instrument has less history |
| Last tested | 2026-10-04 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 1 hour | n/a | 3,648 | 28.95 | 1,520 EUR | -968 |
| EUR/USD | Daily | n/a | 456 | 28.95 | 47,951 USD | -35,610 |
| Nikkei 225 | 4 hours | n/a | 891 | 33.00 | 26,857 USD | -8,671 |
| Nikkei 225 | Daily | n/a | 469 | 29.00 | 26,566 USD | -14,917 |
| Dow Jones | Daily | n/a | 470 | 36.81 | 17,943 EUR | -8,111 |
| Dow Jones | 4 hours | n/a | 356 | 35.11 | 11,432 EUR | -8,152 |
| Nasdaq 100 | Daily | n/a | 458 | 34.06 | 11,429 EUR | -6,178 |
| Nasdaq 100 | 4 hours | n/a | 1,047 | 34.86 | 10,295 EUR | -5,941 |
| DAX 40 | 4 hours | n/a | 1,033 | 33.69 | 9,779 EUR | -3,377 |
| Brent Crude | Daily | n/a | 204 | 34.80 | 8,304 EUR | -7,582 |
| DAX 40 | Daily | n/a | 627 | 32.38 | 8,262 EUR | -5,593 |
| GBP/USD | Daily | n/a | 485 | 32.78 | 8,160 USD | -6,692 |
| DAX 40 | 1 hour | n/a | 3,614 | 30.94 | 8,105 EUR | -5,357 |
| Dow Jones | 1 hour | n/a | 1,302 | 32.33 | 7,767 EUR | -7,268 |
| Gold | 4 hours | n/a | 989 | 34.18 | 2,895 EUR | -1,279 |
| S&P 500 | Daily | n/a | 522 | 33.72 | 2,816 EUR | -782 |
| Gold | Daily | n/a | 518 | 29.92 | 1,793 EUR | -1,512 |
Charts
Top 10 of 17 runs. The full list is in the table above.
The code
// ============================================================== // EMA and DI Trend Long // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long only // Timeframe tested: 1 hour // ============================================================== DEFPARAM CumulateOrders = false ema = ExponentialAverage[9](close) myDiplus = DIplus[14](close) myDiminus = DIminus[14](close)
12 more lines: the entry and exit rules.
Setup
Questions
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.
It was tested on 17 market and timeframe combinations. The best run by trade count was Gold, 1 hour, with 3,648 trades.
The best run had a maximum drawdown of 968 EUR at the tested position size, against a net result of 1,520 EUR.
It only takes long trades.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.