The idea buys when the MACD line crosses above its signal line while the 200-period SMA is not falling, and sells short on the mirror-image cross while it is falling. Trades use a 0.5 percent stop and 1.5 percent target.
Best run of 9. Gold, 5 min, spread 0.6, from run sweeps:2026-10-03-GOLD-5m-opt.tsv:20.
| Period | Up to 2026-10-03 |
| 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-03 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 5 min | n/a | 2,635 | 28.65 | 2,207 EUR | -706 |
| USD/JPY | 10 min | n/a | 2,305 | 29.72 | 290,960 USD | -163,380 |
| EUR/USD | 2 min | n/a | 2,464 | 21.92 | 73,026 USD | -27,278 |
| EUR/USD | 3 min | n/a | 2,530 | 23.87 | 36,724 USD | -25,152 |
| EUR/USD | 4 hours | n/a | 1,314 | 27.85 | 34,032 USD | -19,066 |
| EUR/USD | Daily | n/a | 524 | 28.82 | 27,879 USD | -12,524 |
| Nasdaq 100 | Daily | n/a | 459 | 20.04 | 1,980 EUR | -1,440 |
| Gold | 4 hours | n/a | 1,141 | 27.17 | 1,108 EUR | -533 |
| Brent Crude | Daily | n/a | 206 | 27.67 | 944 EUR | -677 |
Charts
The code
// ============================================================== // MACD Cross With Trend Slope // ProRealAlgos Strategy Library | prorealalgos.com // Type: Momentum // Direction: Long & short // Timeframe tested: 5 minutes // ============================================================== DEFPARAM CumulateOrders = false myMacd = MACDline[12,26,9](close) signal = ExponentialAverage[9](myMacd) sma = Average[200](close)
28 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 9 market and timeframe combinations. The best run by trade count was Gold, 5 minutes, with 2,635 trades.
The best run had a maximum drawdown of 706 EUR at the tested position size, against a net result of 2,207 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.