Regime filter for gold EAs: why trend lanes should sleep in a flat year
Gold can spend a long stretch in a strong directional move and then a long stretch without one. A trend-breakout Expert Advisor will look very different in those two environments. This note explains a simple regime filter we use on gold and reports what happened when we tried to relax it or turn it off.
The figures below are MetaTrader 5 Strategy Tester backtests, not live trading results. Past performance, simulated or real, does not guarantee future results.
The test protocol
All numbers are from one control setup, called set 81, on XAUUSD H1, in a separate sandbox terminal. The tester used every tick based on real ticks, a $600 deposit and leverage 1:500. The broker server in the reports is FreshForex-MT5.
Two windows were used as the standard comparison:
- 1 January 2024 – 12 November 2026: net profit $4,724.76, profit factor 3.54, equity drawdown 9.31%, 331 trades, recovery factor 14.04.
- 1 January 2020 – 31 December 2023: net profit $503.75, profit factor 1.48, equity drawdown 38.21%, 177 trades, recovery factor 1.92.
The second window is weaker. That is the practical reason for a regime filter: a trend lane that stays active through a dull or two-sided year can add trades without adding quality to the book.
What mom250 is
The filter is a longer-term momentum measure. Once a day it stores
mom250 = close / close[250 daily bars] − 1
It is the fractional change of the daily close over 250 daily bars, or roughly a year of daily data. It is not recalculated on every H1 bar.
Two thresholds with hysteresis decide whether the trend-oriented lanes are allowed to open new trades:
- the regime turns on when the absolute value of mom250 reaches 0.20;
- the regime turns off when the absolute value of mom250 falls below 0.15.
Hysteresis stops a measure that sits near a single cut-off from switching the lanes on and off too often. In the Expert Advisor we tested, this gate applies to the MAG (momentum) lane and to the TREND (breakout) lane. The short lane is not gated by this filter and was left unchanged in these tests.
Year by year inside 2024–2026
The 2024–2026 window is not one uniform bull market. The same control, split by calendar year in the tester (2026 runs to 11 November), gave:
- 2024: net profit $684.58, profit factor 2.63, equity drawdown 20.90%, 82 trades;
- 2025: net profit $2,574.69, profit factor 3.61, equity drawdown 9.66%, 167 trades;
- 2026 (to 11 November): net profit $1,868.28, profit factor 5.16, equity drawdown 7.83%, 92 trades.
2024 is the softer year inside an otherwise strong window: more than twice the drawdown of 2025 or 2026, and a lower profit factor. 2025 and 2026 carried most of the result. A filter that reduces trend entries when momentum is not there is trying to protect the quality of the book, not to maximize the trade count in every calendar year.

What happened when we turned the gates off
We then ran the same tester protocol on 1 January 2024 – 11 November 2026 with the MAG and TREND regime gates switched on or off. The control (both gates on) reprinted the set 81 figures: net profit $4,724.76, profit factor 3.54, equity drawdown 9.31%, 331 trades.
- MAG gate on, TREND gate off: net profit $4,726.84, profit factor 3.46, equity drawdown 9.30%, 339 trades.
- MAG gate off, TREND gate on: net profit $4,685.81, profit factor 3.01, equity drawdown 9.22%, 372 trades.
- both gates off: net profit $4,653.40, profit factor 2.97, equity drawdown 10.91%, 378 trades.
Turning both gates off added 47 trades and reduced net profit. The profit factor fell from 3.54 to 2.97, and drawdown rose from 9.31% to 10.91%. Extra activity was not an improvement.
The year split shows where those extra trades came from. In 2024, switching the MAG gate off (TREND still on) raised net profit from $684.58 to $802.25 and the trade count from 82 to 116, but the profit factor fell from 2.63 to 2.15. In 2025 the four combinations were identical: $2,574.69, profit factor 3.61, 167 trades — the filter was not the binding constraint that year. In 2026, switching the MAG gate off reduced net profit from $1,868.28 to $1,792.86 and the profit factor from 5.16 to 3.85, while trades rose from 92 to 100.
A shorter slice, 16 September 2026 – 11 November 2026, makes the same point more sharply. With both gates on, the tester reported net profit $112.41, three trades and equity drawdown 9.73% (profit factor is 0 in that file because there were no losing trades). With the MAG gate off, net profit was $36.99, profit factor 1.21, equity drawdown 17.62%, 11 trades. More trades, more drawdown, less profit.

Relaxing the thresholds instead of removing the filter
A second series kept the MAG gate and lowered its on/off thresholds below the default 0.20 / 0.15. On 1 January 2024 – 11 November 2026 the highest net profit in that series was $4,728.15, with on = 0.08 and off = 0.04: profit factor 3.15, equity drawdown 9.15%, 364 trades. That is $3.39 above the control, at a lower profit factor (3.15 against 3.54) and 33 extra trades.
Several neighbouring threshold pairs clustered around $4,650–$4,713 with profit factors near 3.13–3.42. None of them improved the control on profit, profit factor and drawdown together. Invalid pairs where the off threshold was at or above the on threshold produced no trades, as they should.
We therefore rejected both ideas: turning the gates off, and relaxing the MAG thresholds in this range. Set 81 stays as it is, with the regime on at 0.20 and off at 0.15.
This article does not add a separate threshold study for 2020–2023. What we have for that window is the control itself: $503.75, profit factor 1.48, equity drawdown 38.21%, 177 trades. That is already enough to show that a gold trend system can look very different outside a strong year.
What we take from this
A regime filter is a way of saying that a trend lane should be allowed to sleep. In these tests, leaving the MAG and TREND lanes on through weaker momentum did not make the 2024–2026 book better. It added trades, mostly in the softer stretches, and it reduced the profit factor. The default hysteresis of 0.20 / 0.15 was also not improved by moving both thresholds closer to zero.
This is not a forecast. Broker, spread, commission, slippage and settings all change the numbers. A filter that helped in these two historical windows can fail in the next one. The claim is narrower: on this protocol, the regime gate earned its place, and we kept it.
The control used here is the current preset of Golden Sniper XAU, a MetaTrader 5 Expert Advisor for XAUUSD H1:
https://www.mql5.com/en/market/product/207995
The product page describes the same momentum regime in the Trend lane. The figures in this article are Strategy Tester backtests of set 81. They are not live results and do not guarantee future results. Trading gold with leverage can lead to the loss of the entire deposit.
Free indicator by the same author: Swing Structure ATR — https://www.mql5.com/en/market/product/208384


