Buys when the MACD histogram has risen for two bars in a row. Closes the long when the histogram falls below its value from two bars earlier.
Best run of 8. Gold, 4 hours, spread 0.6, from run pf:2026-10-13-GOLD-4h.tsv:6.
| Period | Up to 2026-10-13 |
| Instrument | Gold, 4 hours |
| 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-13 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 4 hours | 1.21 | 2,712 | 42.51 | 2,948 EUR | -677 |
| DAX 40 | 4 hours | 1.12 | 2,622 | 44.97 | 13,020 EUR | -2,697 |
| Nikkei 225 | 4 hours | n/a | 2,200 | 42.82 | 20,532 USD | -14,119 |
| Silver | 4 hours | n/a | 2,712 | 38.42 | 18,590 USD | -15,519 |
| Dow Jones | Daily | n/a | 1,272 | 43.55 | 16,720 EUR | -10,659 |
| DAX 40 | Daily | n/a | 1,328 | 41.57 | 8,196 EUR | -4,872 |
| Nasdaq 100 | 4 hours | n/a | 2,776 | 41.64 | 6,882 EUR | -5,002 |
| Nasdaq 100 | Daily | n/a | 1,003 | 42.77 | 5,694 EUR | -4,661 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // Rising MACD Histogram Long // ProRealAlgos Strategy Library | prorealalgos.com // Type: Momentum // Direction: Long only // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false myMacd = ExponentialAverage[6](close) - ExponentialAverage[26](close) signal = Average[9](myMacd) hist = myMacd - signal
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 8 market and timeframe combinations. The best run was Gold, 4 hours, with a profit factor of 1.21 over 2,712 trades.
The best run had a maximum drawdown of 677 EUR at the tested position size, against a net result of 2,948 EUR.
It only takes long trades.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.