From 77604960f55b4067b1ff21f088d4a9d07ba42b8e Mon Sep 17 00:00:00 2001 From: Harwinder Sekhon Date: Fri, 10 Jul 2026 20:53:23 -0400 Subject: [PATCH] Gate all XAU-only aggregator logic by pair MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SELL quality gate (6e), SELL volatility gate (6g), M5 noise gates (6h), ATR trade-setup generator, and M5 pullback archetype are all gold-tuned but previously keyed only on xau_strategy.enabled or the timeframe, so they would have silently applied gold constants to any other pair. Each now also requires display_name == "XAU/USD". No behavior change for XAU (conditions are tautologically true for the only registered pair today) — verified by test suite and pinned-window backtest CSV diff. Co-Authored-By: Claude Fable 5 --- signal_aggregator.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/signal_aggregator.py b/signal_aggregator.py index 7e6d24f..6f14bb0 100755 --- a/signal_aggregator.py +++ b/signal_aggregator.py @@ -704,6 +704,7 @@ class SignalAggregator: or (report.final_signal == SignalStrength.NEUTRAL and report.final_score < 0) ) if (self.config.xau_strategy.enabled + and report.display_name == "XAU/USD" and xau_is_sell_dir and report.signal_quality not in self.config.xau_strategy.sell_min_quality): report.warnings.append( @@ -734,6 +735,7 @@ class SignalAggregator: # Shorts in quiet markets fade against gold's macro uptrend; # only take sells when volatility regime confirms real selling. if (self.config.xau_strategy.enabled + and report.display_name == "XAU/USD" and xau_is_sell_dir and report.signal_quality in ("A+", "A", "B", "C") and report.volatility_regime @@ -744,12 +746,16 @@ class SignalAggregator: report.signal_quality = "D" report.trade_setup = None - # ── 6h. M5 noise gate ──────────────────────────────────── - if self.config.primary_timeframe == Timeframe.M5: + # ── 6h. M5 noise gate (gold-tuned thresholds — XAU only) ── + if (self.config.primary_timeframe == Timeframe.M5 + and report.display_name == "XAU/USD"): self._apply_m5_filters(report) # ── 7. Trade setup for actionable signals ────────────────── - if report.trade_setup is None and report.signal_quality in ("A+", "A"): + # ATR generator is XAU-only: it hardcodes gold pip value and + # 2-decimal price rounding. + if (report.trade_setup is None and report.signal_quality in ("A+", "A") + and report.display_name == "XAU/USD"): atr = (report.primary_analysis.key_levels.get("atr", 0) if report.primary_analysis else 0) if atr > 0: @@ -765,6 +771,7 @@ class SignalAggregator: # trend-continuation pullback (retrace to EMA21/KC-mid). Runs # after reasons so its marker lands at reasons[0] for tagging. if (self.config.primary_timeframe == Timeframe.M5 + and report.display_name == "XAU/USD" and self.config.xau_strategy.m5_pullback_enabled and report.trade_setup is None and report.signal_quality != "F"):