The strategy buys when price breaks above the highest high of the last 20 bars while the 9-period EMA is above the 20-period EMA. It sells short on the mirror breakdown below the lowest low, with a 6% stop and 12% target.
Best run of 7. Gold, 1 hour, spread 0.6, from run sweeps:2026-10-07-GOLD-1h-opt.tsv:2.
| Period | Up to 2026-10-07 |
| 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-07 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 1 hour | n/a | 2,322 | 36.74 | 1,804 EUR | -1,104 |
| USD/JPY | Daily | n/a | 307 | 38.44 | 1,879,020 USD | -1,104,290 |
| Silver | 4 hours | n/a | 688 | 37.65 | 27,189 USD | -12,321 |
| US Crude Oil | Daily | n/a | 439 | 35.76 | 9,748 EUR | -6,074 |
| Brent Crude | Daily | n/a | 205 | 37.56 | 9,609 EUR | -8,443 |
| Gold | Daily | n/a | 380 | 34.74 | 2,894 EUR | -892 |
| Gold | 4 hours | n/a | 618 | 39.97 | 2,877 EUR | -808 |
Charts
The code
// ============================================================== // EMA Filtered Range Breakout // ProRealAlgos Strategy Library | prorealalgos.com // Type: Breakout // Direction: Long & short // Timeframe tested: 1 hour // ============================================================== DEFPARAM CumulateOrders = false emafast = ExponentialAverage[9](close) emaslow = ExponentialAverage[20](close) res = highest[20](high)[1] sup = lowest[20](low)[1]
16 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 7 market and timeframe combinations. The best run by trade count was Gold, 1 hour, with 2,322 trades.
The best run had a maximum drawdown of 1,104 EUR at the tested position size, against a net result of 1,804 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.