Buys pullbacks above the 200-period average and sells short rallies below it, each measured from the 20-period average by the 20-period ATR. Long trades exit above the 20-period average plus that ATR, short trades below the average minus it.
Best run of 2. Gold, Daily, spread 0.6, from run pf:2026-10-11-GOLD-D.tsv:21.
| Period | Up to 2026-10-11 |
| Instrument | Gold, Daily |
| 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-11 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | Daily | 1.39 | 255 | 67.06 | 13,146 EUR | -4,655 |
| EUR/USD | Daily | 1.23 | 246 | 64.63 | 4,733 USD | -3,961 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // ATR Envelope Pullback (long and short) // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false ONCE capital = 10000
27 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 2 market and timeframe combinations. The best run was Gold, Daily, with a profit factor of 1.39 over 255 trades.
The best run had a maximum drawdown of 4,655 EUR at the tested position size, against a net result of 13,146 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.