Buys when the 20-period EMA is above the 50-period EMA and Bollinger width rises over 9% in one bar, and sells short on the mirror setup. Exits when price crosses a 22-bar high or low offset by 4 times the average true range.
Best run of 7. Gold, 30 min, spread 0.6, from run sweeps:2026-10-12-GOLD-30m-opt.tsv:45.
| Period | Up to 2026-10-12 |
| Instrument | Gold, 30 minutes |
| 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-12 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 30 min | n/a | 2,346 | 38.92 | 2,522 EUR | -1,028 |
| Nikkei 225 | Daily | n/a | 103 | 43.69 | 26,611 USD | -12,115 |
| Nikkei 225 | 3 min | n/a | 2,247 | 35.96 | 12,646 USD | -7,943 |
| US Crude Oil | 30 min | n/a | 2,203 | 40.35 | 6,437 EUR | -4,595 |
| Gold | 1 hour | n/a | 1,393 | 40.34 | 2,331 EUR | -606 |
| Gold | 4 hours | n/a | 330 | 38.79 | 1,738 EUR | -597 |
| Gold | 3 min | n/a | 2,142 | 35.99 | 811 EUR | -538 |
Charts
The code
// ============================================================== // Band Width Expansion Trend // ProRealAlgos Strategy Library | prorealalgos.com // Type: Volatility // Direction: Long & short // Timeframe tested: 30 minutes // ============================================================== DEFPARAM CumulateOrders = false ONCE myRoc = 0 myAtr = AverageTrueRange[22](close) longstop = highest[22](high) - myAtr * 4 shortstop = lowest[22](low) + myAtr * 4 slow = ExponentialAverage[50](close) fast = ExponentialAverage[20](close) basis = Average[40](close) dev = STD[40](close) width = 0
25 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, 30 minutes, with 2,346 trades.
The best run had a maximum drawdown of 1,028 EUR at the tested position size, against a net result of 2,522 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.