The strategy buys when the MACD histogram crosses above zero while price is at or above a 50-period EMA, and sells short on the mirror condition. Each position closes when the histogram starts moving against it, and an opposite signal reverses it.
Best run of 8. DAX 40, 4 hours, spread 3, from run pf:2026-10-12-DAX40-4h.tsv:1.
| Period | Up to 2026-10-12 |
| Instrument | DAX 40, 4 hours |
| Spread | 3 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 |
|---|---|---|---|---|---|---|
| DAX 40Best run | 4 hours | 1.28 | 1,301 | 41.05 | 11,155 EUR | -1,676 |
| USD/JPY | 4 hours | 1.23 | 1,441 | 40.32 | 532,240 USD | -107,840 |
| EUR/USD | 4 hours | n/a | 1,826 | 37.24 | 20,631 USD | -11,752 |
| Silver | Daily | n/a | 530 | 33.77 | 12,842 USD | -5,192 |
| Nikkei 225 | 4 hours | n/a | 1,041 | 36.70 | 6,824 USD | -5,469 |
| DAX 40 | Daily | n/a | 656 | 40.40 | 5,019 EUR | -3,518 |
| Gold | 4 hours | n/a | 1,270 | 36.14 | 769 EUR | -721 |
| Gold | Daily | n/a | 571 | 39.23 | 585 EUR | -250 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // MACD Histogram Cross Filter // ProRealAlgos Strategy Library | prorealalgos.com // Type: Momentum // Direction: Long & short // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false myMacd = ExponentialAverage[12](close) - ExponentialAverage[26](close) signal = ExponentialAverage[9](myMacd) hist = myMacd - signal ema = ExponentialAverage[50](close)
17 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 8 market and timeframe combinations. The best run was DAX 40, 4 hours, with a profit factor of 1.28 over 1,301 trades.
The best run had a maximum drawdown of 1,676 EUR at the tested position size, against a net result of 11,155 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.