Daily-trend veto on M15 + lot-size / already-open lines (campaign 2026-09-30), and the 2026-10-01 whole-codebase bug review

Two bodies of work that touch the same files, so one commit.

Direction and setup-size campaign (2026-09-30 → 10-01, owner's RISK-FIRST rule,
written before the runs):
- SIGNAL: M15 daily-trend veto (factory override 7, xau_strategy.daily_trend_veto
  "both"). A finished setup against a clear daily trend (closed D1 bars, Sunday
  stubs dropped; close vs its 50-bar EMA AND vs the close 60 kept days earlier)
  is removed as the last step of the core. One definition
  (signal_aggregator.daily_trend_series) for live, the bar replay and the twin's
  host side; D1 is a required frame of the M15 scan; mirrored in
  cuda_signal_kernels.py K2. W3 824 / +205.12R / PF 1.73 / max DD 12.4R vs
  1105 / +195.79R / 1.49 / 20.9R; 2019 → 2026 1473 / +223.33R / 1.42 / 41.5R vs
  2091 / +192.53R / 1.24 / 64.8R; unseen holdout −4.62R vs −6.63R.
- FAILED, not shipped: the veto on M5 (W3 drawdown 10.1R → 15.2R) and on H1
  (−9.7R), buy-only and sell-only on M15, the wide-stop cap
  (xau_strategy.wide_stop_cap_atr stays 0.0, a research knob).
- New M15 pins: W2 dfc647ee…, OOS e87b6de1…, W3 ad3b0dbd…. M5 / H1 / H4 pins
  unchanged. --set xau_strategy.daily_trend_veto=off reproduces the previous M15
  pins byte for byte. Twin and reference script MD5-equal on every window;
  recorder and feature-export parity re-proved; base-rate table rebuilt.
- DISPLAY (books byte-identical): exposure.py — the lot size for
  trade_size.risk_per_trade (new config.json block, off by default, private to
  the owner) and the count of alerted same-direction plans still open
  (signals.alerted_at, read-only open_alerted_setups); the daily trend in words
  on Telegram, the CLI and the dashboard; signals.daily_trend logged.
- providers/oanda: a date window with no bars is an empty page, not an error
  (a D1 pad starting on a Saturday could not be fetched).
- Reports only, nothing shipped: seven context screens (no state nominated) and
  eight outside data sources (none adds a forecast to gold's own daily trend).
- Independent verification (report section 5.13): every figure reproduced on
  both scripts, scoring identical to the previous commit on all four
  timeframes, no look-ahead. Caveats recorded there: this is a risk filter, not
  a more accurate direction call; nine tenths of the 2019 → 2026 gain is 2022;
  the neighbour clause is thin (a simple 100-day average misses the R line by
  1.2R); "never adds a trade" is an observation, not a guarantee.

Bug review of the whole codebase (2026-10-01). Signal path clean. 17 defects
elsewhere, plus 4 found by an independent review of the fixes; all fixed, each
with a test; no trade book changed:
- telegram_bot: one _deliver_alert for the candle scan and the level break. The
  row is stamped alerted_at BEFORE the send, on a one-worker alert-db pool, and
  un-stamped when no chat received it or the task is cancelled mid-stamp, so
  two alerts at one candle close count each other and no SQLite write runs on
  the event loop. The 5-bar cooldown counts bars of the scan's own frame
  (== gpu_backtest._apply_cooldown; clock time released the 22:00 UTC bar after
  the settlement pause) and is restored from signals.db at start-up. The
  lot-size line goes to the owner's own chat only (a group the owner ran
  /autoscan in used to receive it). /status gains a news-model line and escapes
  failure details.
- signal_log: mark_alerted returns the stamp it wrote; unmark_alerted;
  last_alerted_bars (read-only).
- advisory_outcome: candle continuity is judged bar by bar inside the walk; a
  hole after a trade's exit no longer voids it. The stored-candle replay
  resolves 108 of 111 logged setups instead of 99, all equal to the live
  resolver's R.
- providers/oanda: an empty date window is accepted only when it is 5 days or
  shorter and no malformed candle was skipped; a longer one is retried, then
  refused, instead of being cached as history with a hole.
- news_engine: blank RSS titles skipped; one unreadable headline no longer
  costs the local model its whole batch (checked on the real bundle); model
  health recorded; no DeepSeek audit call in a process that does not archive;
  event-direction cache keyed per release; peek_week_events never fetches.
- llm_client: chat_json never raises and never logs the API key (requests
  quotes the Authorization value in InvalidHeader; error bodies are redacted).
- signal_aggregator: the scan's news block is guarded; the replay path
  (use_news=False) assigns exactly the values it did before.
- agent_panel: PANEL_PROMPT_VERSION v2.2 — same prompt text, corrected input
  (event timing over the cached calendar week, headlines newest first).
  scripts/panel_replay.py replays the logged payload per persona;
  scripts/label_scan_outcomes.py counts with an ISO cutoff.
- test_all.py: no ALTER TABLE … DROP COLUMN (the live box has SQLite 3.34);
  tests that write Parquet print a notice and return without pyarrow.

Verification after the last code change: suite 632 passed, 0 failed (also with
both Parquet engines blocked and FB2_BACKEND=cpu, the live box's view); the
five reference MD5s reproduce on both backtesters, 0 cache fallbacks; Module 37
green; static Python 3.9 / SQLite 3.34 check clean on every touched file.

Evidence: backtest/research/daily_trend_campaign_2026-09-30.md,
context_screens_2026-10.md, new_inputs_2026-10.md; CLAUDE.md sections 2, 4, 6,
8, 9, 10 and 11; pair_signals/xauusd.py docstring (M15 override 7).
This commit is contained in:
Harwinder Sekhon
2026-10-01 10:28:28 -04:00
parent 42025da0b0
commit 2cc5915b00
31 changed files with 6021 additions and 286 deletions
+304
View File
@@ -0,0 +1,304 @@
# New data sources for the direction call — a report-only study, 2026-10-01
Owner decision 2026-09-30: after the daily-trend work, study new data sources and report; nothing
ships from this file. The engine reads gold's own price and nothing else. The question here is
whether anything OUTSIDE gold's own chart tells the direction better than gold's chart already
does. Sections 1 to 3 were written before any data was fetched.
## 1. Sources
| # | Source | What it is | Where from | When a value is usable |
|---|---|---|---|---|
| 1 | Dollar | EUR/USD daily candles, read upside down (a falling EUR/USD is a rising dollar) | Oanda v20 candles, the live feed's own token | daily close + 0 (same rule as gold's daily bars) |
| 2 | Silver | XAG/USD daily candles | Oanda v20 | daily close |
| 3 | US 10-year note | USB10Y_USD daily candles (price up = yields down), if Oanda offers it | Oanda v20 | daily close |
| 4 | Real yield | US 10-year inflation-indexed yield, `DFII10` | FRED (public CSV) | the day's value from two days later (it is published the next US afternoon) |
| 5 | Broad dollar index | `DTWEXBGS` | FRED | same two-day rule |
| 6 | Gold fund holdings | SPDR Gold Shares, shares outstanding (each share is a fixed slice of the vault, so creations and redemptions are the fund's gold flow) | the fund manager's public history file (`navhist-us-en-gld.xlsx`); the older tonnes archive now serves a PDF | the day's value from two days later |
| 7 | Futures positioning | CFTC disaggregated report, gold (code 088691), managed-money net long | CFTC public reporting site | a Tuesday report from the following Monday |
| 8 | Oanda client positioning | position book for XAU_USD: the share of Oanda clients' open gold positions that are long (by count) | Oanda v20 `/v3/instruments/XAU_USD/positionBook`, one snapshot per day at 00:00 UTC | at once (the snapshot is taken at the daily close) |
Everything fetched stays in the session scratchpad. Nothing is added to the repository's cache.
Amendment before any analysis (2026-10-01, after the access probes and nothing else): the plan
expected source 8 to be gone. It is not: on the practice API the position book answers for every
date probed back to 2017, so it joins the study with the definition below. The probe printed ten
long-share readings (between 60% and 75% long, higher at higher gold prices) and no forward
returns; that is everything that was seen before the definition was fixed. Source 6 uses shares
outstanding instead of tonnes because that is the file that can still be downloaded.
## 2. One state per source
The same shape as the shipped daily trend, so the comparison is like for like. For a daily series
`x` (Sunday stub bars dropped for the Oanda candles): `up` when `x` is above its 50-day EMA AND
above its value 60 days earlier, `down` when below both, else `unclear`. Read for gold:
| Source | Gold-friendly state | Gold-hostile state |
|---|---|---|
| Dollar (EUR/USD) | EUR/USD up (dollar falling) | EUR/USD down |
| Silver | up | down |
| 10-year note price | up (yields falling) | down |
| Real yield | down | up |
| Broad dollar index | down | up |
| Fund holdings | shares outstanding above the level 20 trading days earlier | below |
| Futures positioning | managed-money net long above its level 4 reports earlier | below |
| Oanda client positioning | long share `down` (the crowd is cutting longs or adding shorts) | long share `up` (the crowd is adding longs) |
The positioning state is read the contrarian way on purpose and before looking: small traders
tend to buy dips and sell rallies, so a growing long share is expected to go with a falling price.
Test A is two-sided, so if the truth is the other way round it will show as a real spread with the
opposite sign and is reported as such; Test B is judged on the declared reading only.
## 3. Two tests and the verdict rule
**Test A — forward move of gold.** Every closed gold daily bar from 2019-01-01 to 2026-08-07.
Forward move = gold's close 5 days later minus today's close, in units of gold's own 14-day ATR
(and the same for 20 days). For each source: mean forward move on gold-friendly days minus mean
on gold-hostile days, (i) over all days and (ii) inside each of gold's own three daily-trend
states (rising / falling / unclear), in two eras (2019–2023, 2024–2026). The spread is called real
only if it has the same sign in both eras and its t-value, computed on every fifth day so the
5-day windows do not overlap, is at least 2 in each era.
**Test B — the shipped books.** M15 LONG (daily-trend veto on, 1473 trades) and M5 LONG (1052
trades), $0.65. Each trade is labelled `friendly` / `hostile` / `unclear` from the source state at
its decision time, mirrored for a SELL. A source is interesting on a timeframe only if its
`hostile` trades are at least 8% of the book and lose (total R < 0) in BOTH eras.
**Verdict per source.**
- `GO` (worth a pre-registered campaign and the feed work it needs) only if Test A calls the
spread real INSIDE gold's own trend states (that is the "beyond gold's own chart" part) AND
Test B finds the hostile trades losing in both eras on at least one timeframe.
- `WATCH` if exactly one of the two holds.
- `NO-GO` otherwise, or when the source cannot be fetched reliably.
A `GO` is a ticket to a campaign, never a shipping decision: a live feed for a second instrument
needs its own provider path, cache, staleness rule and live == backtest proof.
Two points of method were fixed while the analysis script was written, before it produced any
output. (1) The broad dollar index is published weekly (the H.10 release, on Monday, for the week
before), not daily, so the "two-day rule" of the table would have looked ahead: each week's final
state is used from the Tuesday after that week. (2) "Inside gold's own trend states" is computed
as one stratified number per era: the forward move minus the mean forward move of that day's gold
trend state (rising / unclear / falling), friendly days against hostile days, t-value on every
fifth day. That is the column the verdict reads; the unstratified spread is printed beside it.
## 4. Results
Run 2026-10-01. Fetched into the session scratchpad: Oanda daily candles for EUR_USD, XAG_USD,
USB10Y_USD and XAU_USD (2015-01-01 → 2026-09-30, about 3,650 bars each, about 600 Sunday stubs
dropped); the Oanda XAU_USD position book, one snapshot per day at 00:00 UTC from 2018-06-01
(2,609 days asked, 97.7% answered at exactly 00:00, the rest from the last snapshot up to six
hours earlier, 45 days with none, all before mid-2022); FRED `DFII10` and `DTWEXBGS`; the gold
fund's history file (5,540 days since 2004); 1,059 weekly CFTC reports since 2006.
### 4.1 What was fetched
| Source | Days with a state, 2019-01-01 → 2026-08-07 | friendly / unclear / hostile | Same side as gold's own daily trend (days where both are clear) |
|---|---|---|---|
| 1 dollar (EUR/USD) | 1973 | 37% / 18% / 44% | 67% of 1363 |
| 2 silver | 1973 | 49% / 21% / 31% | 88% of 1387 |
| 3 10-year note price | 1973 | 39% / 16% / 46% | 73% of 1398 |
| 4 real yield (DFII10) | 1973 | 42% / 20% / 39% | 73% of 1353 |
| 5 broad dollar index | 1973 | 39% / 19% / 42% | 62% of 1362 |
| 6 gold fund shares | 1973 | 51% / 0% / 49% | 77% of 1639 |
| 7 futures positioning | 1973 | 51% / 0% / 49% | 59% of 1644 |
| 8 Oanda client positioning | 1973 | 37% / 15% / 48% | 36% of 1414 |
Gold itself, same days: rising 58%, unclear 17%, falling 25%; mean 5-day forward move +0.27 ATR (rising +0.32, unclear +0.30, falling +0.14).
### 4.2 Test A — gold's forward move, friendly days minus hostile days (in daily ATRs)
| Source | Era | Days friendly / hostile | 5-day spread, all days (t) | 5-day spread inside gold's trend states (t) | 20-day spread inside gold's trend states (t) | Real? |
|---|---|---|---|---|---|---|
| 1 dollar (EUR/USD) | 2019–2023 | 443 / 623 | -0.04 (-0.3) | -0.05 (-0.4) | +0.35 (+0.7) | |
| 1 dollar (EUR/USD) | 2024–2026 | 296 / 249 | +0.21 (+0.7) | +0.20 (+0.7) | +0.80 (+0.5) | |
| 1 dollar (EUR/USD) | verdict | | | same sign in both eras: no; |t| ≥ 2 in both: no | | not real |
| 2 silver | 2019–2023 | 548 / 449 | -0.21 (-0.9) | -0.25 (-1.0) | -1.00 (-1.2) | |
| 2 silver | 2024–2026 | 411 / 160 | -0.10 (-0.7) | -0.20 (-0.7) | -0.64 (-0.2) | |
| 2 silver | verdict | | | same sign in both eras: yes; |t| ≥ 2 in both: no | | not real |
| 3 10-year note price | 2019–2023 | 515 / 603 | +0.08 (+0.3) | +0.04 (+0.1) | +0.46 (+0.5) | |
| 3 10-year note price | 2024–2026 | 253 / 295 | +0.23 (+0.4) | +0.17 (+0.4) | +1.02 (-0.2) | |
| 3 10-year note price | verdict | | | same sign in both eras: yes; |t| ≥ 2 in both: no | | not real |
| 4 real yield (DFII10) | 2019–2023 | 583 / 468 | +0.04 (+0.4) | +0.01 (+0.2) | -0.20 (-0.5) | |
| 4 real yield (DFII10) | 2024–2026 | 242 / 294 | +0.20 (+0.7) | +0.14 (+0.6) | +1.22 (+0.5) | |
| 4 real yield (DFII10) | verdict | | | same sign in both eras: yes; |t| ≥ 2 in both: no | | not real |
| 5 broad dollar index | 2019–2023 | 497 / 536 | +0.03 (-0.1) | +0.02 (-0.1) | -0.12 (-0.5) | |
| 5 broad dollar index | 2024–2026 | 269 / 293 | +0.02 (-0.2) | +0.04 (-0.0) | +0.71 (+0.1) | |
| 5 broad dollar index | verdict | | | same sign in both eras: yes; |t| ≥ 2 in both: no | | not real |
| 6 gold fund shares | 2019–2023 | 609 / 681 | +0.20 (+1.4) | +0.17 (+1.2) | +0.37 (+1.0) | |
| 6 gold fund shares | 2024–2026 | 393 / 281 | +0.40 (+1.7) | +0.36 (+1.8) | +1.09 (-0.1) | |
| 6 gold fund shares | verdict | | | same sign in both eras: yes; |t| ≥ 2 in both: no | | not real |
| 7 futures positioning | 2019–2023 | 640 / 656 | +0.06 (+0.0) | +0.04 (-0.1) | +1.03 (+0.6) | |
| 7 futures positioning | 2024–2026 | 369 / 308 | -0.01 (+0.3) | +0.11 (+0.8) | +1.23 (+1.7) | |
| 7 futures positioning | verdict | | | same sign in both eras: yes; |t| ≥ 2 in both: no | | not real |
| 8 Oanda client positioning | 2019–2023 | 636 / 428 | +0.20 (+1.2) | +0.19 (+1.1) | +0.53 (+0.1) | |
| 8 Oanda client positioning | 2024–2026 | 97 / 516 | -0.01 (-0.6) | +0.33 (+0.3) | n/a (too few friendly days) | |
| 8 Oanda client positioning | verdict | | | same sign in both eras: yes; |t| ≥ 2 in both: no | | not real |
### 4.3 Test B — the shipped books, by the source's state at the trade's decision time
**M15 LONG (daily-trend veto on): 1473 trades, +223.3R** (era A = 2019–2023: 728 trades, +36.8R; era B = 2024–2026: 745 trades, +186.6R)
| Source | Trade state | Trades (share) | Total R / mean | Era A R (trades) | Era B R (trades) | Hostile ≥ 8% and losing in both eras |
|---|---|---|---|---|---|---|
| 1 dollar (EUR/USD) | friendly | 725 (49%) | +127.3 / +0.176 | +32.0 (345) | +95.4 (380) | |
| 1 dollar (EUR/USD) | unclear | 252 (17%) | +13.0 / +0.052 | -15.3 (127) | +28.3 (125) | |
| 1 dollar (EUR/USD) | hostile | 496 (34%) | +83.0 / +0.167 | +20.1 (256) | +62.9 (240) | no |
| 2 silver | friendly | 937 (64%) | +154.9 / +0.165 | +26.8 (406) | +128.0 (531) | |
| 2 silver | unclear | 304 (21%) | +1.3 / +0.004 | -18.2 (196) | +19.5 (108) | |
| 2 silver | hostile | 232 (16%) | +67.1 / +0.289 | +28.1 (126) | +39.0 (106) | no |
| 3 10-year note price | friendly | 753 (51%) | +107.0 / +0.142 | +34.6 (397) | +72.4 (356) | |
| 3 10-year note price | unclear | 254 (17%) | +39.1 / +0.154 | +11.3 (121) | +27.8 (133) | |
| 3 10-year note price | hostile | 466 (32%) | +77.2 / +0.166 | -9.2 (210) | +86.4 (256) | no |
| 4 real yield (DFII10) | friendly | 723 (49%) | +97.7 / +0.135 | +45.5 (405) | +52.2 (318) | |
| 4 real yield (DFII10) | unclear | 313 (21%) | +30.8 / +0.098 | -12.5 (142) | +43.2 (171) | |
| 4 real yield (DFII10) | hostile | 437 (30%) | +94.9 / +0.217 | +3.8 (181) | +91.1 (256) | no |
| 5 broad dollar index | friendly | 647 (44%) | +122.5 / +0.189 | +37.5 (315) | +85.0 (332) | |
| 5 broad dollar index | unclear | 277 (19%) | +17.2 / +0.062 | -4.7 (168) | +21.8 (109) | |
| 5 broad dollar index | hostile | 549 (37%) | +83.7 / +0.152 | +3.9 (245) | +79.8 (304) | no |
| 6 gold fund shares | friendly | 1031 (70%) | +183.6 / +0.178 | +52.7 (519) | +130.9 (512) | |
| 6 gold fund shares | unclear | 7 (0%) | -4.7 / -0.668 | -2.9 (4) | -1.8 (3) | |
| 6 gold fund shares | hostile | 435 (30%) | +44.4 / +0.102 | -13.1 (205) | +57.5 (230) | no |
| 7 futures positioning | friendly | 789 (54%) | +115.5 / +0.146 | +22.3 (422) | +93.3 (367) | |
| 7 futures positioning | unclear | 0 (0%) | +0.0 / | +0.0 (0) | +0.0 (0) | |
| 7 futures positioning | hostile | 684 (46%) | +107.8 / +0.158 | +14.5 (306) | +93.3 (378) | no |
| 8 Oanda client positioning | friendly | 394 (27%) | +41.7 / +0.106 | +15.9 (326) | +25.9 (68) | |
| 8 Oanda client positioning | unclear | 198 (13%) | +26.9 / +0.136 | +13.7 (122) | +13.2 (76) | |
| 8 Oanda client positioning | hostile | 881 (60%) | +154.7 / +0.176 | +7.2 (280) | +147.5 (601) | no |
**M5 LONG: 1052 trades, +128.1R** (era A = 2019–2023: 258 trades, -10.4R; era B = 2024–2026: 794 trades, +138.5R)
| Source | Trade state | Trades (share) | Total R / mean | Era A R (trades) | Era B R (trades) | Hostile ≥ 8% and losing in both eras |
|---|---|---|---|---|---|---|
| 1 dollar (EUR/USD) | friendly | 439 (42%) | +85.3 / +0.194 | -11.5 (103) | +96.8 (336) | |
| 1 dollar (EUR/USD) | unclear | 211 (20%) | +28.6 / +0.136 | -0.9 (34) | +29.5 (177) | |
| 1 dollar (EUR/USD) | hostile | 402 (38%) | +14.2 / +0.035 | +2.0 (121) | +12.2 (281) | no |
| 2 silver | friendly | 556 (53%) | +89.3 / +0.161 | -7.6 (113) | +96.8 (443) | |
| 2 silver | unclear | 143 (14%) | +7.3 / +0.051 | -9.9 (45) | +17.2 (98) | |
| 2 silver | hostile | 353 (34%) | +31.5 / +0.089 | +7.1 (100) | +24.4 (253) | no |
| 3 10-year note price | friendly | 432 (41%) | +51.6 / +0.120 | -0.6 (119) | +52.2 (313) | |
| 3 10-year note price | unclear | 169 (16%) | -9.5 / -0.056 | -13.7 (49) | +4.2 (120) | |
| 3 10-year note price | hostile | 451 (43%) | +86.0 / +0.191 | +3.9 (90) | +82.1 (361) | no |
| 4 real yield (DFII10) | friendly | 377 (36%) | +4.2 / +0.011 | -15.0 (115) | +19.2 (262) | |
| 4 real yield (DFII10) | unclear | 186 (18%) | +32.3 / +0.174 | -7.0 (45) | +39.3 (141) | |
| 4 real yield (DFII10) | hostile | 489 (46%) | +91.6 / +0.187 | +11.6 (98) | +80.0 (391) | no |
| 5 broad dollar index | friendly | 447 (42%) | +131.2 / +0.294 | -0.7 (91) | +131.9 (356) | |
| 5 broad dollar index | unclear | 170 (16%) | +8.1 / +0.047 | -6.0 (40) | +14.1 (130) | |
| 5 broad dollar index | hostile | 435 (41%) | -11.2 / -0.026 | -3.7 (127) | -7.5 (308) | YES |
| 6 gold fund shares | friendly | 600 (57%) | +86.9 / +0.145 | -15.8 (142) | +102.7 (458) | |
| 6 gold fund shares | unclear | 3 (0%) | -1.8 / -0.608 | +0.0 (0) | -1.8 (3) | |
| 6 gold fund shares | hostile | 449 (43%) | +43.0 / +0.096 | +5.4 (116) | +37.6 (333) | no |
| 7 futures positioning | friendly | 493 (47%) | +41.1 / +0.083 | -17.0 (120) | +58.1 (373) | |
| 7 futures positioning | unclear | 0 (0%) | +0.0 / | +0.0 (0) | +0.0 (0) | |
| 7 futures positioning | hostile | 559 (53%) | +87.0 / +0.156 | +6.6 (138) | +80.4 (421) | no |
| 8 Oanda client positioning | friendly | 313 (30%) | +17.9 / +0.057 | -1.9 (99) | +19.8 (214) | |
| 8 Oanda client positioning | unclear | 92 (9%) | +2.3 / +0.025 | +0.5 (40) | +1.9 (52) | |
| 8 Oanda client positioning | hostile | 647 (62%) | +107.9 / +0.167 | -8.9 (119) | +116.9 (528) | no |
### 4.4 Verdict per source
| Source | Test A: real spread beyond gold's own trend | Test B: hostile trades ≥ 8% and losing in both eras (M15 / M5) | Verdict |
|---|---|---|---|
| 1 dollar (EUR/USD) | no | no / no | NO-GO |
| 2 silver | no | no / no | NO-GO |
| 3 10-year note price | no | no / no | NO-GO |
| 4 real yield (DFII10) | no | no / no | NO-GO |
| 5 broad dollar index | no | no / yes | WATCH |
| 6 gold fund shares | no | no / no | NO-GO |
| 7 futures positioning | no | no / no | NO-GO |
| 8 Oanda client positioning | no | no / no | NO-GO |
### 4.5 The one flag, looked at more closely (after the fact: description, not a test)
**M5 LONG: gold's own daily trend (rows) x 5 broad dollar index (columns)** — total R (trades)
| Gold's own daily trend vs the trade | dollar friendly | dollar unclear | dollar hostile |
|---|---|---|---|
| with | +118.8 (352) | +1.9 (105) | -0.1 (215) |
| unclear | +6.8 (33) | -2.1 (12) | +2.3 (73) |
| against | +5.6 (62) | +8.3 (53) | -13.3 (147) |
**M5 LONG: gold's own daily trend (rows) x 1 dollar (EUR/USD) (columns)** — total R (trades)
| Gold's own daily trend vs the trade | dollar friendly | dollar unclear | dollar hostile |
|---|---|---|---|
| with | +76.8 (372) | +23.0 (109) | +20.7 (191) |
| unclear | +4.5 (37) | -5.5 (19) | +7.9 (62) |
| against | +4.0 (30) | +11.1 (83) | -14.4 (149) |
**M5 LONG: broad-dollar hostile trades by year** — 2019: +1.4 (14); 2020: -3.4 (45); 2021: -0.6 (21); 2022: -1.1 (36); 2023: -0.1 (11); 2024: +3.5 (68); 2025: -8.5 (107); 2026: -2.4 (133)
**M5 LONG: broad-dollar friendly trades by year** — 2019: -1.5 (3); 2020: +0.0 (45); 2021: -0.0 (9); 2022: +0.0 (7); 2023: +0.7 (27); 2024: -0.1 (19); 2025: +40.3 (160); 2026: +91.7 (177)
W3 friendly: 397 trades (46%), +145.1R, halves +8.2 / +136.9
W3 unclear: 150 trades (17%), +15.6R, halves -3.0 / +18.7
W3 hostile: 323 trades (37%), -7.1R, halves +11.6 / -18.7
**M15 LONG (veto on): gold's own daily trend (rows) x 5 broad dollar index (columns)** — total R (trades)
| Gold's own daily trend vs the trade | dollar friendly | dollar unclear | dollar hostile |
|---|---|---|---|
| with | +93.2 (561) | +48.0 (196) | +68.5 (416) |
| unclear | +29.3 (86) | -30.8 (81) | +15.2 (133) |
| against | +0.0 (0) | +0.0 (0) | +0.0 (0) |
**M15 LONG (veto on): gold's own daily trend (rows) x 1 dollar (EUR/USD) (columns)** — total R (trades)
| Gold's own daily trend vs the trade | dollar friendly | dollar unclear | dollar hostile |
|---|---|---|---|
| with | +99.4 (635) | +41.8 (176) | +68.5 (362) |
| unclear | +27.9 (90) | -28.8 (76) | +14.5 (134) |
| against | +0.0 (0) | +0.0 (0) | +0.0 (0) |
**M15 LONG (veto on): broad-dollar hostile trades by year** — 2019: +12.5 (57); 2020: +11.5 (74); 2021: -6.7 (44); 2022: -9.2 (43); 2023: -4.1 (27); 2024: +65.1 (179); 2025: +9.9 (95); 2026: +4.8 (30)
**M15 LONG (veto on): broad-dollar friendly trades by year** — 2019: +4.7 (16); 2020: +25.0 (114); 2021: -8.9 (46); 2022: +8.2 (51); 2023: +8.5 (88); 2024: -4.4 (56); 2025: +52.1 (192); 2026: +37.3 (84)
W3 friendly: 373 trades (45%), +103.5R, halves +4.0 / +99.4
W3 unclear: 130 trades (16%), +28.2R, halves +6.2 / +22.1
W3 hostile: 321 trades (39%), +73.4R, halves +66.5 / +6.9
### 4.6 Reading
- **Nothing outside gold's own chart passes Test A.** For all eight sources the 5-day forward move
of gold on "friendly" days is not reliably different from "hostile" days once gold's own daily
trend is accounted for (largest t-values 1.2 and 1.8, the gold fund's share count; everything
else is under 1.2 in at least one era). The familiar stories (a falling dollar, falling real
yields, rising silver, fund inflows) describe gold's past move well: they sit on the same side
as gold's own daily trend on 59% to 88% of clear days. They do not add a forecast to it.
- **Oanda client positioning is available but not useful in this form.** The plan expected the
endpoint to be gone; it answers, with history back to 2017. Read the contrarian way (a growing
long share is hostile), the spread has the expected sign and no weight (t 1.1 and 0.3), and in
2024–2026 the crowd was adding longs on 516 of 613 clear days while gold rose. The trades taken
on those "hostile" days are the best part of both books. Only the daily state was tested; the
intraday snapshots (one per hour) were not.
- **The one flag is the broad dollar index on M5** (`WATCH`): the 435 M5 trades taken against the
dollar's trend lost 11.2R in total and lost in both eras, while the 447 taken with it made
+131.2R. The closer look shows what that is. All of the M5 profit sits in one cell: trades with
gold's own daily trend AND with the dollar's trend (+118.8R over 352 trades); the same trades
against the dollar's trend made nothing (−0.1R over 215). But every R of the friendly side was
earned in 2025 and 2026 (+40.3R and +91.7R), that is inside the one long rally from 2,600 to the
March 2026 peak (in 2025 the broad dollar fell 7.5% while gold rose 65%); before 2025 the
dollar's state separates nothing on M5 because the M5 book earned nothing at all. In the 3-year
window the hostile trades are positive in the first half (+11.6R) and negative only in the
second (−18.7R). On M15 the same state separates nothing: the hostile
trades made +65R in 2024 alone, a year when gold and the dollar rose together. The timelier
dollar measure (EUR/USD) shows the same lean on M5 without losing in both eras. So this is one
market phase seen from another angle, not a second source of information; it stays a
hypothesis, and it is the same picture as the context screens: M5 pays only when everything
agrees and has paid only since 2025.
### 4.7 Verdict
| Source | Verdict | Why |
|---|---|---|
| Dollar via EUR/USD | NO-GO | no forward spread; hostile trades are not losers in both eras |
| Silver | NO-GO | 88% the same information as gold's own trend; the spread has the wrong sign |
| US 10-year note | NO-GO | no forward spread |
| Real yield | NO-GO | no forward spread; on M5 the "hostile" trades are the better ones |
| Broad dollar index | WATCH | M5 trades against it lose in both eras, but the forward test finds nothing and the effect is the 2025–2026 phase; weekly data, four to ten days old when used |
| Gold fund share count | NO-GO | the nearest miss in the forward test (t 1.2 and 1.8), nothing on the books |
| Futures positioning | NO-GO | no forward spread, no difference on the books |
| Oanda client positioning | NO-GO in this daily form | available, but the contrarian reading failed in the rising years |
**Nothing ships and no feed is added.** The direction call was improved by the one input that
passed a formal test, gold's own daily chart on M15. If the M5 question is taken up again, the
honest test is forward: `signals.daily_trend` is now logged on every scan, so a few months of live
M5 rows can be split by the daily trend, and by the dollar's trend after the fact, without touching
the signal code.