The strategy marks a tight, flat 15-bar range as a box, then buys when a close breaks above the box top or sells short when a close breaks below the box bottom. Breakouts are only taken in the direction of the 150-period EMA.
Best run of 9. Gold, 1 hour, spread 0.6, from run sweeps:2026-10-04-GOLD-1h-opt.tsv:108.
| 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 | 1,014 | 35.60 | 1,087 EUR | -932 |
| USD/JPY | Daily | n/a | 69 | 46.38 | 7,610 USD | -1,930 |
| Dow Jones | 1 hour | n/a | 371 | 37.20 | 7,101 EUR | -4,784 |
| Dow Jones | Daily | n/a | 60 | 35.00 | 5,903 EUR | -3,123 |
| Nasdaq 100 | Daily | n/a | 22 | 50.00 | 4,496 EUR | -1,570 |
| Silver | Daily | n/a | 32 | 37.50 | 3,396 USD | -3,030 |
| US Crude Oil | Daily | n/a | 20 | 60.00 | 3,332 EUR | -1,632 |
| Gold | 4 hours | n/a | 118 | 44.07 | 1,339 EUR | -424 |
| S&P 500 | Daily | n/a | 38 | 44.74 | 874 EUR | -210 |
Charts
The code
// ============================================================== // Volatility Box Breakout // ProRealAlgos Strategy Library | prorealalgos.com // Type: Breakout // Direction: Long & short // Timeframe tested: 1 hour // ============================================================== DEFPARAM CumulateOrders = false ONCE boxready = 0 ONCE zhigh = 0 ONCE zlow = 0 ONCE boxstart = 0 ONCE lastentry = -999 ema = ExponentialAverage[150](close) myAtr = AverageTrueRange[14](close) highline = highest[15](high) lowline = lowest[15](low) boxh = highline - lowline slope = abs(LinearRegressionSlope[15](close) / close) * 1000
34 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 9 market and timeframe combinations. The best run by trade count was Gold, 1 hour, with 1,014 trades.
The best run had a maximum drawdown of 932 EUR at the tested position size, against a net result of 1,087 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.