The strategy buys when price is below the midpoint of the latest swing high and swing low but above the 50-bar average. It sells short on the mirror setup, and uses a 2% stop from entry with no profit target.
Best run of 11. Gold, 30 min, spread 0.6, from run sweeps:2026-10-07-GOLD-30m-opt.tsv:12.
| 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-07 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 30 min | n/a | 3,710 | 33.15 | 2,349 EUR | -1,766 |
| USD/JPY | Daily | n/a | 260 | 34.23 | 2,322,900 USD | -830,330 |
| USD/JPY | 30 min | n/a | 3,685 | 36.61 | 658,020 USD | -316,170 |
| EUR/USD | Daily | n/a | 255 | 37.65 | 137,181 USD | -45,419 |
| EUR/USD | 4 hours | n/a | 823 | 37.55 | 56,350 USD | -38,012 |
| Nikkei 225 | Daily | n/a | 354 | 17.51 | 27,920 USD | -17,283 |
| US Crude Oil | Daily | n/a | 475 | 14.95 | 19,645 EUR | -5,797 |
| Brent Crude | Daily | n/a | 205 | 15.61 | 17,655 EUR | -4,885 |
| GBP/USD | Daily | n/a | 284 | 34.51 | 11,919 USD | -7,118 |
| Gold | Daily | n/a | 378 | 22.49 | 2,819 EUR | -1,108 |
| Gold | 4 hours | n/a | 579 | 35.92 | 1,603 EUR | -1,393 |
Charts
Top 10 of 11 runs. The full list is in the table above.
The code
// ============================================================== // Swing Midpoint Trend Pullback // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: 30 minutes // ============================================================== DEFPARAM CumulateOrders = false ONCE swh = 0 ONCE swl = 0 ONCE hasswh = 0 ONCE hasswl = 0
29 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 11 market and timeframe combinations. The best run by trade count was Gold, 30 minutes, with 3,710 trades.
The best run had a maximum drawdown of 1,766 EUR at the tested position size, against a net result of 2,349 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.