Does the stochastic oversold strategy work on gold?

XAU/USD, 4-hour chart, Oct 2, 2016 to Oct 1, 2026. Backtest run on October 2, 2026.

Key results

Total return
+104.5%
Buy & hold: +217.9%
Annual return (CAGR)
+7.4%
Buy & hold: +12.3%
Max drawdown
-11.4%
Buy & hold: -28.5%
Win rate
32.31%
Profit factor
1.58
Trades
130
Longest losing streak
12 trades
Period
Oct 2, 2016 to Oct 1, 2026
10 years
Market
XAU/USD
4-hour

Equity curve vs buy & hold

StrategyBuy & hold
Cumulative return of the strategy and of buy and hold, XAU/USD, Oct 2, 2016 to Oct 1, 2026At the end of the period the strategy is at +104.6%, against +217.9% for buying and holding XAU/USD over the same days.
Cumulative return in percent of the starting capital. The dashed line holds the asset for the whole period.

Returns year by year

YearReturnTrades
2016-9.8%5
2017+8.2%9
2018+1.2%8
2019+7.8%5
2020+24.7%18
2021-6.4%13
2022+0.4%13
2023+9.2%12
2024+18.9%5
2025+25.5%15
2026+0.5%27

Calendar years, compounded from monthly results. The first and last years can be partial.

The stochastic oscillator is one of the oldest momentum tools on any trading platform. Most traders learn the same rule first: below 20 is oversold, above 80 is overbought. Buying the moment the stochastic dips under 20 often means catching a falling market. A more patient version waits for the line to cross back above 20, a sign the selling has paused. We paired that entry with a wide target on gold, a market known for strong trends, and ran it over ten years.

The rules we tested

  • Market: gold (XAU/USD), 4-hour candles.
  • Period: 2 October 2016 to 1 October 2026, ten years.
  • Indicator: Stochastic(14, 3, 3) on the 4-hour chart.
  • Entry: buy when the stochastic %K crosses above 20.
  • Exit: a fixed stop-loss 2% below entry and a fixed take-profit 7% above it, a 1:3.5 risk-reward.
  • Direction: long only. No short trades.
  • Costs: 0.02% commission per side, full position size on each trade.

What the backtest shows

The strategy doubled the account: +105% in ten years, about 7.4% a year, from 130 trades. Holding gold returned +218%, about 12.3% a year.

The risk picture is where it stands out. The maximum drawdown was about 11%, against about 28% for buy and hold. The Sharpe ratio was 0.70.

Only about 32% of trades won, and that is by design. The average win was about 6.8% and the average loss about 2.0%, for a profit factor of 1.58. Of the 130 trades, 88 hit the stop and 41 reached the target. The price of this structure is patience: the longest losing streak was twelve trades in a row.

2025 was the best year at +26%, as gold trended hard, closely followed by 2020 at +25%. 2024 made +19% from only five trades, four of them winners. The worst full year was 2021 at -6%, with only 2 winners out of 13 trades, and the short opening stretch of 2016 lost more (about -10% on five trades, all losers).

A low win rate is a feature here

With a 7% target against a 2% stop, losing two trades out of three is expected. If you trade a setup like this, the hard part is sitting through a dozen losses in a row without changing the rules.

Why it works

Gold tends to trend, and pullbacks inside those trends often push the stochastic into oversold territory. Waiting for the cross back above 20 filters out part of the falling-knife entries, and the wide 7% target lets the trades that catch a new leg up run long enough to pay for many small losses.

It still trails buy and hold because it is long only and flat most of the time: about 13 trades a year, each held until it hits 2% down or 7% up. In a decade where gold more than tripled, any strategy that sits in cash between signals gives up a large part of the trend.

What you could test next

  • Add a trend filter, such as close above a 200-period moving average, to skip oversold signals in downtrends.
  • Try a trailing stop instead of the fixed 7% target, to stay in the strongest trends longer.
  • Compare thresholds: a cross above 10 or 30 instead of 20.
  • Run the same rules on the Nasdaq 100 or the S&P 500, two other markets with long uptrends.

Methodology and assumptions

Starting capital
10,000
Position size
100% of equity
Commission
0.02% per side
Data window
Oct 2, 2016 to Oct 1, 2026
Run date
October 2, 2026
  • No repainting: every signal is computed on closed candles only, so the backtest never acts on a price a trader could not have seen yet.
  • Past performance does not predict future results. A backtest is a historical simulation, not a forecast.

Frequently asked questions

How do you trade the stochastic oscillator oversold signal?

The stochastic measures where the close sits within the recent high-low range, from 0 to 100. Below 20 is considered oversold. A common entry is to buy when the %K line crosses back above 20, which signals that the market is leaving the oversold area rather than still falling into it.

What stochastic settings did this backtest use?

Stochastic(14, 3, 3) on the 4-hour gold chart: a 14-period lookback, 3-period smoothing of %K and a 3-period %D. The entry used %K crossing above 20.

How can a 32% win rate be profitable?

Because the target was 3.5 times the stop (7% against 2%). If every trade ended at one or the other, the break-even win rate before costs would be about 22%. The strategy won about 32% of the time, for a profit factor of 1.58.

Is the stochastic strategy better than buying and holding gold?

On return, no: +105% against +218%. On risk, yes: a maximum drawdown of about 11% against about 28%. It depends on what you are optimising for.

Reproduce it, then change it

Every number on this page comes from the Backtrex engine. Rebuild the strategy in the app, then change the market, the timeframe or a parameter and see whether the result holds.

Ready to backtest your strategies?

Create your free account and take the guided tour: a real 10-year backtest in 3 minutes, no coding, no credit card.

Create your account in 30 seconds and run your first backtest. No credit card.

Other backtests