The strategy goes long when price breaks above a contraction box formed by narrowing pivots, and sells short when price breaks below it. The position is a stop-and-reverse with a stop at a SuperTrend level.
Best run of 9. Gold, 30 min, spread 0.6, from run sweeps:2026-10-07-GOLD-30m-opt.tsv:29.
| Period | Up to 2026-10-07 |
| 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-10 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 30 min | n/a | 1,043 | 23.68 | 925 EUR | -909 |
| USD/JPY | Daily | n/a | 71 | 1.41 | 239,660 USD | -222,570 |
| Nikkei 225 | Daily | n/a | 51 | 27.45 | 37,580 USD | -7,762 |
| Dow Jones | 30 min | n/a | 370 | 23.51 | 9,504 EUR | -4,788 |
| Nasdaq 100 | 15 min | n/a | 972 | 20.78 | 8,653 EUR | -3,362 |
| Nasdaq 100 | 4 hours | n/a | 133 | 17.29 | 6,209 EUR | -3,846 |
| Gold | 1 hour | n/a | 700 | 22.29 | 1,366 EUR | -569 |
| S&P 500 | 30 min | n/a | 829 | 23.88 | 1,235 EUR | -1,024 |
| S&P 500 | 4 hours | n/a | 121 | 22.31 | 937 EUR | -595 |
Charts
The code
// ============================================================== // Pivot Contraction Box Breakout // ProRealAlgos Strategy Library | prorealalgos.com // Type: Breakout // Direction: Long & short // Timeframe tested: 30 minutes // ============================================================== DEFPARAM CumulateOrders = false ONCE ub = 0 ONCE lb = 0 ONCE dir = 1 ONCE st = 0 ONCE phy = 0 ONCE ply = 0 ONCE pht = 0 ONCE plt = 0 ONCE top = 0 ONCE btm = 0 ONCE havetb = 0 len = 12 myAtr = AverageTrueRange[10](close) upper = MedianPrice + 3.0 * myAtr lower = MedianPrice - 3.0 * myAtr
97 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, 30 minutes, with 1,043 trades.
The best run had a maximum drawdown of 909 EUR at the tested position size, against a net result of 924 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.