Buys a dip in an uptrend and sells short a bounce in a downtrend, both measured as 3 times the 20-period ATR from the 40-bar high or low. Long trades exit above the prior 40-bar high, short trades below the prior 40-bar low.
Best run of 1. Gold, Daily, spread 0.6, from run pf:2026-10-11-GOLD-D.tsv:22.
| 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.38 | 236 | 61.02 | 17,580 EUR | -5,845 |
Charts
The code
// ============================================================== // ATR Scaled Dip Buying (long and short) // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false ONCE capital = 10000
26 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 one combination, Gold, Daily, with a profit factor of 1.38 over 236 trades.
The best run had a maximum drawdown of 5,845 EUR at the tested position size, against a net result of 17,580 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.