A Mean-Reversion Gold System Using Stochastic Extremes
- Algomatic Trading
- Aug 24
- 3 min read
A surprisingly simple strategy that captures turning points in gold with included dynamic risk management.
A lot of traders obsess over predicting where gold is going. They spend hours glued to charts, trying to predict the market.
But what if the secret isn’t prediction at all — but exploiting the extremes of trader behavior? In this article, I’ll show you a strategy I call Stochastic Extremes on Gold.
It’s a simple rules-based system that use a stochastic crossover and a trend filter, I am also using ATR-based position sizing. I will also explain my plan for future strategy releases and how you can support me if you like what I share here on Substack.
The Problem…
Gold is a trader’s paradox:
It trends beautifully… until it whipsaws.
It reacts to macro news… but also ignores fundamentals for weeks.
Many traders get losing streaks by chasing “breakouts” or fading “fake moves.”
The mistake?
Trading gold without a systematic edge. Most traders either overtrade the noise or size their positions poorly, blowing up accounts when volatility spikes.
That’s where this strategy comes in.

Strategy Overview
At its core, Stochastic Extremes on Gold is about catching exhaustion at the edges while keeping losses small.
Here’s the basic logic (Code is in the end of the post):
Market: Gold (Tested on both Futures and CFD).
Timeframe: 2-hour bars.
Entries (Long/Short):
Long Stochastic Crossover
Short Stochastic Crossover
Filters: Avoid trades during lowest-liquidity hours and also an added trendfilter.
Risk: Dynamic ATR-based position sizing with stop-loss protection.
Exits: ATR-based trailing stop to capture runners.

Backtest Setup
Instrument: Gold 1€ (CFD).
Timeframe: 2-hour bars.
Period Tested: April 2006 — Aug 2025 (with out-of-sample 2021-now).
Starting Capital: $20,000.
Position Sizing: ATR-based.
Stops: Fixed % stop-loss + ATR trailing stop.
Spread: 0,5 p

Results & Metrics
Backtesting results:
CAGR: +4.98%
Max Drawdown: -8.8%
Win Rate: 68,95%
MAR Ratio: 0.56
Profit Factor: 1.65
Avg Gain Per Trade: 64€

Why It Works
Markets are driven by behavioral extremes. Traders panic when oscillators hit the floor (oversold) and get euphoric when they spike high (overbought). The strategy exploits these points of exhaustion — but only if the trend confirms.
The ATR-based sizing and trailing stops keep losses contained while allowing big wins to run.
This combination of mean reversion entry + trend-following exit is a proven robust edge.
Variations & Robustness Tests
I can only go back as far as 2006 on 2h bars on my platform which is why that’s the start of the backtest. The average holding period is short enough to make CFDs more profitable than futures with this strategy but it works very well on both instruments.
The data for gold futures does for some reason only go back to 2018 but I have tested it on those 7 years for the extra robustness and this is the results.
Gold Futures with adjusted size:

Gold CFDs with adjusted size:

I stress-tested the strategy across variations:
Parameter Sensitivity: Performance is stable across multiple thresholds and nearby parameters. (Trendfilter values, Stop loss values, Stochastic Thresholds, ATR values and time filters)
Different time filters: Performs similarly even with 10–25% of trades filtered away with different time filter settings.
Alternative timeframes: Still profitable on 1H & 4H.
Bottom line: robust across parameters.
Takeaways & Next Steps
Grasp the Core Concepts: Don’t just copy the code. Understand why each indicator and rule is in place. This foundational knowledge is your true edge.
Simulate, Learn, Refine: Start with paper trading and backtesting. This allows you to gain confidence in the strategy.
Strict Risk Management: No strategy, no matter how powerful, works without disciplined risk management.
Continuous Learning: Markets are dynamic. While the underlying principles of mean reversion are timeless, stay open to understanding how market conditions might impact strategy performance over time.
Now, you have a choice. You can try to reverse-engineer this on your own, spending countless hours on the work.
Or, you can fast-track the process by getting the full strategy with code and support my work at the same time by becoming a paid member on my Substack HERE.