The strategy trades MACD crossovers that agree with a 200 period EMA trend and a momentum filter. The stop sits at the 25 bar swing low or high, with a target at 1.5 times that risk.
Best run of 16. Gold, 1 hour, spread 0.6, from run pf:2026-10-12-GOLD-1h.tsv:1.
| Period | Up to 2026-10-12 |
| 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-12 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 1 hour | 1.62 | 264 | 46.59 | 1,032 EUR | -204 |
| Nikkei 225 | Daily | n/a | 15 | 73.33 | 7,552 USD | -1,713 |
| Nikkei 225 | 4 hours | n/a | 39 | 41.03 | 5,703 USD | -3,278 |
| Nasdaq 100 | 1 hour | n/a | 261 | 38.31 | 4,866 EUR | -1,339 |
| Nasdaq 100 | 4 hours | n/a | 53 | 41.51 | 3,329 EUR | -1,362 |
| Dow Jones | 4 hours | n/a | 22 | 45.45 | 2,925 EUR | -1,726 |
| Nasdaq 100 | 10 min | n/a | 509 | 38.51 | 2,813 EUR | -1,098 |
| US Crude Oil | 1 hour | n/a | 170 | 45.88 | 2,737 EUR | -1,403 |
| Nasdaq 100 | 30 min | n/a | 454 | 38.77 | 2,692 EUR | -2,540 |
| Brent Crude | 1 hour | n/a | 116 | 49.14 | 2,609 EUR | -1,686 |
| FTSE 100 | 1 hour | n/a | 227 | 42.73 | 1,852 EUR | -568 |
| Brent Crude | 4 hours | n/a | 29 | 55.17 | 1,685 EUR | -680 |
| S&P 500 | 4 hours | n/a | 58 | 55.17 | 905 EUR | -444 |
| Gold | 4 hours | n/a | 54 | 53.70 | 663 EUR | -173 |
| S&P 500 | 30 min | n/a | 404 | 40.10 | 520 EUR | -374 |
| S&P 500 | 1 hour | n/a | 261 | 38.31 | 386 EUR | -282 |
Charts
Top 10 of 16 runs. The full list is in the table above.
The code
// ============================================================== // MACD Trend Swing Stop // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: 1 hour // ============================================================== DEFPARAM CumulateOrders = false myMacd = ExponentialAverage[10](close) - ExponentialAverage[23](close) signal = ExponentialAverage[10](myMacd) hist = myMacd - signal rocA = 100 * (close - close[10]) / close[10] rocB = 100 * (close - close[15]) / close[15] rocC = 100 * (close - close[20]) / close[20] rocD = 100 * (close - close[30]) / close[30] kst = Average[11](rocA) + 2 * Average[11](rocB) + 3 * Average[12](rocC) + 4 * Average[16](rocD) kstsig = Average[8](kst) ema = ExponentialAverage[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 16 market and timeframe combinations. The best run was Gold, 1 hour, with a profit factor of 1.62 over 264 trades.
The best run had a maximum drawdown of 204 EUR at the tested position size, against a net result of 1,032 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.