Closes a position when the MACD histogram turns through zero against it. When flat, buys on a histogram turn from negative to positive if the 9-period Hull average is at or above the 200-period average, and sells short on the opposite turn otherwise.
Best run of 10. Gold, 1 hour, spread 0.6, from run sweeps:2026-10-04-GOLD-1h-opt.tsv:35.
| Period | Up to 2026-10-04 |
| 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-04 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 1 hour | n/a | 4,159 | 32.41 | 1,472 EUR | -968 |
| USD/JPY | Daily | n/a | 491 | 34.22 | 1,787,250 USD | -457,840 |
| USD/JPY | 4 hours | n/a | 1,194 | 37.35 | 477,530 USD | -129,490 |
| EUR/USD | Daily | n/a | 487 | 37.58 | 102,537 USD | -26,835 |
| Nikkei 225 | Daily | n/a | 403 | 39.45 | 32,123 USD | -13,680 |
| Silver | Daily | n/a | 442 | 31.90 | 24,991 USD | -22,927 |
| GBP/USD | Daily | n/a | 509 | 38.70 | 11,278 USD | -3,284 |
| DAX 40 | Daily | n/a | 576 | 38.37 | 7,666 EUR | -5,549 |
| Gold | Daily | n/a | 496 | 37.90 | 2,419 EUR | -1,133 |
| Gold | 4 hours | n/a | 1,088 | 35.75 | 1,760 EUR | -638 |
Charts
The code
// ============================================================== // MACD Histogram Turn Filter // ProRealAlgos Strategy Library | prorealalgos.com // Type: Momentum // Direction: Long & short // Timeframe tested: 1 hour // ============================================================== DEFPARAM CumulateOrders = false myMacd = MACDLine[12,26,9](close) hist = myMacd - ExponentialAverage[9](myMacd) wmahalf = WeightedAverage[4](close) wmafull = WeightedAverage[9](close) rawhma = 2 * wmahalf - wmafull hma = WeightedAverage[3](rawhma) sma = Average[200](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 10 market and timeframe combinations. The best run by trade count was Gold, 1 hour, with 4,159 trades.
The best run had a maximum drawdown of 968 EUR at the tested position size, against a net result of 1,472 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.