Multi-layer directional filter for XAUUSD — design pattern feedback (EMA + RSI vs ADX)

 



Hi all,

Working on a directional filter for a systematic XAUUSD strategy. Need feedback from devs who've built trend-filter logic, not on my system architecture.

Setup of the filter:

I want to refuse entries when the price is in a clearly opposite trend context — but not be so strict that I miss genuine pullback/breakout opportunities. Soft filter, not aggressive.

What I've found via data analysis on 4+ years XAUUSD H1:

  • Out of ~10 standard features tested (EMA50/200 slope, close-vs-EMA, RSI14, ADX14, ATR, range%, etc.) the most discriminating are:
    1. RSI14
    2. EMA50 slope (5-bar delta)
    3. close vs EMA50 distance
  • ADX14 scored lowest in feature importance — counterintuitive given how often ADX is recommended as a trend strength filter. Curious if others have seen this on gold specifically.
  • Logistic regression OOS (train 2022-2024 / test 2025-2026) holds AUC > 0.62 on sell-side filter but buy-side filters overfit (AUC drops to 0.50-0.55 on test). Could be 2022-2026 gold bull market biasing the signal.

Current rule (sell-side block only):

block_sell IF close > EMA50 * (1 + 0.0005) AND ema50_slope_5bar > 0 AND RSI14 > 55

AND-gated: blocks only when ALL THREE clearly bullish (= worst-case counter-trend sell).

Questions for the experienced:

  1. AND vs OR vs weighted score — when stacking 3+ conditions in a directional filter, do you prefer hard AND-gating (mine), OR-gating, or a weighted score with threshold? Pros/cons?

  2. Threshold setting without curve-fit — I picked 0.05% EMA buffer + RSI 55 from data means. Better practice: ATR-relative thresholds? Z-score thresholds? Hard fixed?

  3. Why does ADX rank so low on gold? Is gold's volatility regime fundamentally different (frequent regime shifts, news spikes) that makes ADX noisy?

  4. Asymmetric directional filters — buy-side filter failing OOS while sell-side holds: known pattern in trending markets, or signal of overfit on the working side?

  5. Multi-TF confirmation — would you add H4 or D1 EMA alignment as a higher gate (filter only fires if both H1 AND H4 EMA agree)? Risk of over-filtering vs robustness gain?

  6. XAU-specific — anything quirky about gold's intraday/session regimes that should be in the filter (e.g., Asian range, NY break, FOMC blackout)?

Pure design discussion — happy to share findings once tuned.

Thanks!


Best ,  Tony

[Deleted]  

For XAUUSD M5, I prefer using EMA as the primary trend filter and ADX only as a strength confirmation.


RSI often generates too many counter-trend signals during strong gold trends.


My tests showed better stability when trend direction comes from EMA structure and ADX is used to avoid ranging markets.

 

On AND vs weighted score: hard AND-gating is fine for a block filter because you only want to veto in the clear worst case, but it tends to be brittle around the thresholds. A weighted score with a single cutoff is usually more robust out of sample, since no single condition can flip the decision on its own. I would test the weighted version and keep AND only if it clearly wins on the test period, not the train one.


On thresholds: avoid fixed price-distance buffers on gold. A 0.05% EMA buffer means very different things at low vs high volatility. Make the buffer ATR-relative (distance measured in ATR units), so the filter scales with the current regime. That alone usually removes a lot of the curve-fit feel.


ADX ranking low on gold is expected. ADX is slow and smooths across exactly the sharp regime shifts and news spikes that drive XAU, so by the time it confirms, the move is often done. EMA slope reacts faster, which is why your slope feature dominates.


The asymmetric result (sell holds, buy overfits) is almost certainly the 2022-2026 bull bias, not a real edge. In a trending-up sample, a sell-block is easy and a buy-block has little signal. I would not trust the buy side until you test it on a flat or bearish period.


Multi-TF: adding an H4 EMA agreement gate helps robustness more than it hurts, as long as you keep it as a soft confirmation and not a third hard AND. For XAU also consider a session filter (skip the thin Asian range and the minutes around high-impact news), since a lot of false signals cluster there.

 
Cristhian Alexander Gaibor Cuasquer #:

On AND vs weighted score: hard AND-gating is fine for a block filter because you only want to veto in the clear worst case, but it tends to be brittle around the thresholds. A weighted score with a single cutoff is usually more robust out of sample, since no single condition can flip the decision on its own. I would test the weighted version and keep AND only if it clearly wins on the test period, not the train one.


On thresholds: avoid fixed price-distance buffers on gold. A 0.05% EMA buffer means very different things at low vs high volatility. Make the buffer ATR-relative (distance measured in ATR units), so the filter scales with the current regime. That alone usually removes a lot of the curve-fit feel.


ADX ranking low on gold is expected. ADX is slow and smooths across exactly the sharp regime shifts and news spikes that drive XAU, so by the time it confirms, the move is often done. EMA slope reacts faster, which is why your slope feature dominates.


The asymmetric result (sell holds, buy overfits) is almost certainly the 2022-2026 bull bias, not a real edge. In a trending-up sample, a sell-block is easy and a buy-block has little signal. I would not trust the buy side until you test it on a flat or bearish period.


Multi-TF: adding an H4 EMA agreement gate helps robustness more than it hurts, as long as you keep it as a soft confirmation and not a third hard AND. For XAU also consider a session filter (skip the thin Asian range and the minutes around high-impact news), since a lot of false signals cluster there.

Thanks Cristhian, this is the kind of feedback that actually moves the work forward. Applying all four directionally: ATR-relative thresholds replacing fixed-percent buffers, weighted score replacing 3-AND gating, sell-side filter parked until I can test on a non-bull regime, and ADX dropped from the candidate list for gold.

Sent you a PM with a more specific follow-up if you have time. Thanks again.