Buys when the 9-period EMA crosses over the 21-period EMA with the close above the 200-period EMA, and sells short on the opposite cross with the close below it. Positions stay open until an opposite signal reverses them.
Best run of 23. Gold, 5 min, spread 0.6, from run pf:2026-10-04-GOLD-5m.tsv:1.
| Period | Up to 2026-10-04 |
| Instrument | Gold, 5 minutes |
| 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 | 5 min | 1.32 | 1,557 | 23.76 | 3,273 EUR | -592 |
| Gold | 3 min | 1.31 | 1,555 | 23.86 | 3,438 EUR | -662 |
| USD/JPY | 1 hour | n/a | 964 | 26.66 | 956,950 USD | -300,380 |
| USD/JPY | 4 hours | n/a | 276 | 24.64 | 670,560 USD | -379,520 |
| USD/JPY | 10 min | n/a | 1,505 | 25.58 | 438,670 USD | -305,740 |
| EUR/USD | Daily | n/a | 62 | 37.10 | 155,096 USD | -40,420 |
| EUR/USD | 4 hours | n/a | 320 | 26.88 | 93,639 USD | -52,297 |
| Nikkei 225 | Daily | n/a | 63 | 38.10 | 58,699 USD | -26,197 |
| Dow Jones | Daily | n/a | 73 | 34.25 | 45,279 EUR | -11,978 |
| Nasdaq 100 | Daily | n/a | 50 | 36.00 | 30,007 EUR | -5,520 |
| Silver | 5 min | n/a | 1,749 | 21.61 | 27,203 USD | -18,062 |
| Silver | 15 min | n/a | 1,646 | 21.63 | 25,575 USD | -13,852 |
| DAX 40 | Daily | n/a | 97 | 27.84 | 19,093 EUR | -7,174 |
| US Crude Oil | 1 hour | n/a | 598 | 28.26 | 15,074 EUR | -10,862 |
| Dow Jones | 4 hours | n/a | 67 | 35.82 | 13,703 EUR | -6,069 |
| US Crude Oil | 4 hours | n/a | 174 | 27.01 | 11,384 EUR | -5,531 |
| Brent Crude | 4 hours | n/a | 126 | 30.16 | 10,857 EUR | -6,127 |
| S&P 500 | Daily | n/a | 67 | 37.31 | 7,719 EUR | -1,395 |
| GBP/USD | 1 hour | n/a | 1,320 | 26.82 | 7,372 USD | -3,930 |
| Gold | Daily | n/a | 85 | 31.76 | 4,430 EUR | -1,534 |
| Gold | 4 hours | n/a | 205 | 28.29 | 2,677 EUR | -1,345 |
| Gold | 1 hour | n/a | 878 | 25.74 | 1,825 EUR | -1,247 |
| Gold | 2 min | n/a | 1,592 | 23.24 | 1,011 EUR | -986 |
Charts
Top 10 of 23 runs. The full list is in the table above.
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // EMA 9 21 Regime Filtered Crossover // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: 5 minutes // ============================================================== DEFPARAM CumulateOrders = false fastema = ExponentialAverage[9](close) slowema = ExponentialAverage[21](close) regime = ExponentialAverage[200](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 23 market and timeframe combinations. The best run was Gold, 5 minutes, with a profit factor of 1.32 over 1,557 trades.
The best run had a maximum drawdown of 592 EUR at the tested position size, against a net result of 3,273 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.