It arms a long when Williams %R(140) crosses over -94 with the close above the 7-period SMA, then buys when the MACD histogram turns positive. Short signals mirror this, and a position closes when the histogram falls against it.
Best run of 3. DAX 40, 4 hours, spread 3, from run sweeps:2026-10-07-DAX40-4h-opt.tsv:41.
| Period | Up to 2026-10-07 |
| 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-10 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| DAX 40Best run | 4 hours | n/a | 529 | 37.81 | 2,479 EUR | -2,444 |
| USD/JPY | Daily | n/a | 242 | 38.43 | 383,250 USD | -305,300 |
| GBP/USD | Daily | n/a | 240 | 35.42 | 3,690 USD | -3,362 |
Charts
The code
// ============================================================== // Williams %R Armed MACD Histogram // ProRealAlgos Strategy Library | prorealalgos.com // Type: Momentum // Direction: Long & short // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false ONCE buyactive = 0 ONCE sellactive = 0 ONCE wr = -50 hh = highest[140](high) ll = lowest[140](low)
41 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 3 market and timeframe combinations. The best run by trade count was DAX 40, 4 hours, with 529 trades.
The best run had a maximum drawdown of 2,444 EUR at the tested position size, against a net result of 2,479 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.