How a gold ML model decides, and what its honest out-of-sample record is

2 December 2026, 19:21
Abdullah Uygar Tuna
0
11

Probitas Gold ML: a machine-learning EA for XAUUSD on H1.

Product page: https://www.mql5.com/en/market/product/213307

Most EA pages show one perfect backtest curve. This post does the opposite. It explains how Probitas Gold ML makes each decision, then shows the numbers from tests where the model had not seen the data it traded, including the bad years. If you read only one section, read "What the numbers say" and "Why your own backtest will look better than reality".

1. What it is

Probitas Gold ML is a single LightGBM model (gradient-boosted decision trees), exported to ONNX and embedded in the EA. No DLL, no web requests, no external files.

On every completed H1 bar the model scores two hypothetical trades, one long and one short. For each it predicts the result in R (multiples of the money at risk) of a fixed reference trade: stop 2 x ATR, target 4 x ATR, time exit after 16 bars. Predicting R instead of "up or down" means the model has to weigh both how often a trade works and how big the wins and losses are.

There is one position at a time. There is no grid, no martingale, no averaging down and no hedging, and every trade has a stop-loss from the moment it opens.

2. What the model looks at (29 inputs, in plain words)

  • Momentum over 1 to 128 bars (how far price moved, scaled by volatility).
  • Distance to moving averages (EMAs) and where price sits in its recent high-low range.
  • Volatility regime: current ATR against its own history, and range expansion or contraction.
  • Trend strength: ADX and directional movement.
  • Time: hour of day and day of week (gold behaves differently in Asia, London and New York).
  • H4 context: the same ideas measured on the higher timeframe.
  • Cost relative to volatility: what spread plus slippage cost compared with ATR right now.

Nothing in the inputs looks into the future. All features use closed bars only, and the EA and the Python research code produce the same values. A parity check over 58,278 bars matched the signal on 99.3 % of bars.

3. Costs come first

Before every decision the EA estimates, in R:

  • the spread (the typical spread for that hour, scaled to the gold price; if the broker's live spread is more than 3x that, the bar is skipped),
  • slippage on entry and on the stop,
  • the swap for the expected holding time.

A trade is taken only if predicted edge minus costs is at least 0.20 R (the default threshold). Most hours nothing passes, and that is intended: the EA trades a few times per week, not every bar.

4. Exits and risk

  • Default exits: stop 1.5 x ATR, target 5 x ATR, time exit after 8 H1 bars, all positions closed before the weekend. These differ from the 2/4/16 reference trade the model was trained on. The defaults were chosen on 2017-2023 data only and then checked on 2024-2026 (section 6). The model's score is still "how good is this moment", not an exact R forecast for the new exits.
  • Position size: 0.25 % of equity at the stop by default.
  • Small accounts: if 0.25 % is smaller than the risk of one minimum lot (0.01 lot = 1 oz of gold on most brokers), the EA trades the minimum lot only if that lot risks 5 % of equity or less. Otherwise it skips the trade and says so in the log and on the dashboard.
  • Daily loss stop: 6 % of the day's starting balance (it can be changed or switched off).
  • Optional max-drawdown stop for prop-firm rules, static or trailing.

What this means on a $500 account (please read)

Gold is far more volatile now than a few years ago. The H1 ATR was about $2-3 in 2017-2019 and is about $19 in 2026. With a 1.5-ATR stop, one 0.01 lot currently risks about $28, which is about 5-6 % of a $500 account on a single trade. On $500 the 0.25 % setting cannot be met, so the EA trades at 0.01 lot within the 5 % cap and skips signals above it.

In the 2024-2026 test from $500, risk per trade had a median of 2.2 % and a maximum of 5.0 %, and 32 % of the signals were skipped by the cap (74 % in 2026). $500 is the technical minimum, not a comfortable size. For roughly 1-2 % risk per trade at today's volatility, use $1,500-3,000, or a cent account.

5. How it was tested

  1. Walk-forward by year. For each year from 2017 to 2026, a copy of the model was trained only on data before that year and then traded that year. This is the closest a backtest gets to "the model has never seen this". The yearly models were exported to ONNX and run in the MT5 Strategy Tester (1-minute OHLC data, the broker's spreads), with an every-tick check year by year.
  2. Settings chosen on 2017-2023 only. 2024 to 10 Nov 2026 was held back and looked at afterwards.
  3. Stress tests: costs doubled, random execution delay, shifted start dates, and Monte Carlo resampling of the trade order.
  4. Live forward test on a demo account since 11 Nov 2026, with pass/fail checks fixed in advance at 300 and 1,000 trades. It is far too early to judge; there is no live track record yet.

6. What the numbers say (walk-forward, from $500, default settings)

Period Trades Avg R per trade [95 % range] Profit factor Max equity drawdown
2017-2023 (settings chosen here) 728 +0.07 [-0.02, +0.16] 1.13 18.3 %
2024 - 10 Nov 2026 (held back) 136 +0.20 [-0.02, +0.41] 1.66 25.1 %
2017 - 10 Nov 2026, one run 874 +0.08 [+0.00, +0.16] 1.24 19.4 %
  • Losing years: 2018, 2019, 2021, 2023 and 2025. Most of the profit came from 2017, 2020, 2022, 2024 and 2026.
  • Costs doubled: profit factor 1.06 on 2017-2023 and 1.60 on 2024-2026. The edge on 2017-2023 is thin.
  • Monte Carlo (trade order reshuffled 5,000 times, whole 2017-2026 run): typical worst drawdown about 43 % of the $500 start; in the worst 5 % of shuffles, about 80 %.
  • The 95 % ranges for both separate periods include zero. Honestly read: the evidence for an edge is weak to moderate, and 2024-2026 was an unusually good period for gold trend trades. Treat these numbers as a range of outcomes, not a promise.

7. Why your own Strategy Tester run will look better than reality

The model shipped in the EA was trained on data up to 11 Nov 2026. If you backtest it on anything before that date, it is being tested on data it learned from. That is an in-sample test, and it will look much better than live trading can be. With the earlier development settings, the in-sample backtest showed profit factor 1.50 where the walk-forward test showed 1.06.

Only results after 11 Nov 2026, in the tester or live, are genuinely new to the shipped model. That is why section 6 uses the walk-forward copies, and why the live forward test matters more than any backtest. Since the cut-off the shipped model has made 3 trades in the tester (real ticks), far too few to mean anything.

8. Settings guide

Input Default Notes
Risk per trade 0.25 % Used once the account is large enough for the lot step.
Small-account cap 5 % Maximum risk for a forced 0.01 lot; 0 = never trade below the target risk.
Daily loss limit 6 % Of the day's starting balance; 0 = off.
Max drawdown stop off For prop-firm rules; static or trailing.
Minimum edge 0.20 R Higher = fewer, more selective trades.
Stop / target / time exit 1.5 / 5 ATR / 8 bars Changing them changes the tested behaviour.
Broker time auto Detects the server's time zone; manual override available.
Symbol any gold/USD name XAUUSD, GOLD, XAUUSD.m and similar suffixes; other symbols stay idle on live charts.
News filter off Optional MT5-calendar block around high-impact USD news (live only).

Attach it to an XAUUSD chart (any timeframe; it always reads H1) and enable Algo Trading. The dashboard shows the last decision and why, the open trade with its real risk in %, and today's, this week's and drawdown figures.

9. FAQ

  • Does it use martingale or grid? No. One position, fixed stop.
  • Why so few trades? Most hours the predicted edge does not beat costs plus the 0.20 R margin.
  • Will it be retrained? The shipped model is frozen. A new model would only replace it after passing the same out-of-sample checks, and it would be announced as an update.
  • Which brokers? Any MT5 broker with gold. Results depend on spread, commission and swap; check them in your own tester with your broker's data.

Risk disclaimer

Trading leveraged products such as gold CFDs carries a high risk of losing money. Past and backtested results, including out-of-sample ones, do not guarantee future results. Losing streaks and drawdowns of 20 % or more are expected. Only trade money you can afford to lose. This post is not investment advice.