The rules tested
The strategy buys gold when the 10-bar exponential average crosses above the 30-bar one, and sells when it crosses back below. Stop loss at 2 ATR, take profit at 3 ATR, 1% of the account at risk per trade, on 1-hour bars.
- Instrument
- Gold (XAU/USD)
- Timeframe
- 1 hour (H1)
- Entry
- crossover of two exponential moving averages of 10 and 30 bars
- Filters
- none
- Stop loss
- 2 times the 14-bar ATR
- Take profit
- 3 times the 14-bar ATR
- Other exits
- none
- Risk per trade
- 1% of the virtual account, position size set from the stop distance
- Costs
- spread actually recorded hour by hour, slippage of half a spread on every stop, no commission; swaps not included
- Period tested
- from August 1, 2022 to September 25, 2026
The button opens the lab with exactly these settings: change one, run it again and compare.
An isolated setting
The sensitivity test moves the length of the slow average from 15 to 60 bars, with every other setting unchanged. Only one of the nine settings makes money: the 30-bar one, at +7.0%. The other eight all lose, down to -41.7% for the worst. The two closest neighbors make -22.6% with 26 bars and -11.7% with 38.
- 26-bar slow average
- 38-bar slow average
- 30-bar slow average, setting tested
The chart overlays those three settings. A crossover that comes one bar earlier or later changes the entry price, and so sometimes the outcome of the trade; and since the lab holds one position at a time, a different trade also shifts the ones that follow. Over 564 trades, those differences are enough to separate a gain from a loss.
Why this example was chosen
This is the only page in the set whose strategy was chosen for its result. Out of more than 1,200 settings run through the lab while preparing these pages, we looked for one specific case: a winning setting whose immediate neighbors lose. Test enough settings and you will always find one that won in the past. That is exactly what automatic optimization does, and it is why its best results deserve so little trust.
Two clues give such a setting away. First, sensitivity: an isolated peak surrounded by losses. Second, the out-of-sample period: +0.7% over 164 trades, next to nothing, where the design period showed +6.3%. Costs also take a large share of the result, even for the winning setting: +23.4% without spread or slippage, +7.0% with them.
What to ask of a backtest
A backtest report almost always shows the best setting found, rarely its neighbors. Faced with a smooth curve, the right question is not “how much?” but “and with nearby settings?”. If there is no answer, or if the answer shows an isolated peak, the result is most likely luck. Our guide on how to verify a forex EA track record covers the other useful checks.
In the lab, the sensitivity test runs every time: open this strategy, change the slow average, and watch the sensitivity chart move with you.
Design period against out-of-sample
Design period: Aug 1, 2022 to Jun 27, 2025
- Result
- +6.3%
- Trades
- 400
- Maximum drawdown
- 19.6%
- In R
- +9.1 R
Out-of-sample: Jun 27, 2025 to Sep 25, 2026
- Result
- +0.7%
- Trades
- 164
- Maximum drawdown
- 22.8%
- In R
- +1.9 R
Tune the strategy while looking at the design period, then judge it on the out-of-sample period, which played no part in the tuning. A wide gap between the two often means the settings were fitted to the past.
Sensitivity of the main setting
Year by year
| Year | Trades | Result (R) |
|---|---|---|
| 2022 | 60 | +7.1 R |
| 2023 | 130 | -3.2 R |
| 2024 | 140 | +11.9 R |
| 2025 | 134 | -8.3 R |
| 2026 | 100 | +3.6 R |
In R, the multiple of the risk taken on each trade: a yearly total cannot be read as a % of the account, since gains and losses compound from one year to the next.