Strategies
Gold Miners vs Gold Beta-Hedged Residual Reversion: fade a >=2-sigma 10-session GDX-vs-GLD idiosyncratic move, dollar/beta-neutral long-short, 15-session time stop (USEQ 1-DAY)
Outcome: Abandoned
GdxGldBetaHedgedResidualReversion
Outcome Summary
The strategy tried to capture partial reversal of gold-miner moves that gold does not explain, trading GDX against a beta-hedged GLD leg on daily US equity bars. Over 4 iterations the code never passed verification: Layer 1.5 kept flagging a hypothesis/config mismatch because the optimization_plan's exit_z baseline was missing or outside its domain. The run was abandoned in that verification loop, so backtesting, optimization, analyst review and risk review were never reached and no performance metrics exist.
Hypothesis
Two-instrument long-short pair on USEQ daily bars, OHLCV only. GDX starts in 2006 and GLD in 2004, so the overlap is about 19 years. GDX (gold miners) behaves like a levered claim on gold (GLD) because of the miners' operating leverage. Each session the strategy computes: (1) a rolling OLS beta of GDX daily log returns on GLD daily log returns, using data up to the previous session; (2) the daily residual; (3) the residual summed over the last resid_window sessions; and (4) a z-score of that sum against the prior 250 sessions. Large miner moves that gold does not explain are expected to partly reverse within weeks, because miner cash flows stay tied to the gold price. Examples are equity risk-off selling, ETF creation/redemption pressure and sector rotation. This design avoids the dead families in the lessons: the trigger is not a calendar date (L179), there is no crypto supplementary-feed gate (L111), and it uses no options (L102). Leverage is not a research parameter. Gross exposure comes from equity through the fixed gross_exposure_pct.
This fills under-represented buckets: USEQ venue (5.4%), long-short direction (16.3%) and pairs scope. It also moves away from BINANCE (62.5%) and BTC. A zero-commission venue and multi-percent moves per trade address the fee_edge graveyard. About 19 years of daily data gives a large sample, and about 5,000 bars keeps the sandbox run short. Daily, 1-hour and 1-minute bar folders for both GDX.USEQ and GLD.USEQ are in the catalog, but the overlapping daily history was not checked. Leverage is left out of optimization_plan because three recent runs died at Layer 1.5 on 'optimization_plan fixes leverage'.
verification_loop: Verification failed (Layer 1.5 — hypothesis/config consistency) [class=hypothesis_mismatch]: - optimization_plan baseline exit_z is missing or outside its domain
Implementation
Continuously sizes a GDX/GLD beta-hedged pair against prior-session residual z. Rebalances beyond a 0.25 full-allocation band, flattens on sign crossings, correlation below 0.5 or |z| above 3.5, and retains the 6% pair stop, 15-session horizon and three-session cooldown. Target gross exposure is capped at 80% of marked equity.
The supplied previous_code already implements the requested continuous mechanism; the smallest correction makes calculate_signal report the prior-session z actually used for trading, aligning subsequent IC analysis with execution timing. Rolling OLS, residual construction, synchronized daily bars, sizing and risk logic are preserved. Evaluation targets are recorded as metadata for pipeline assessment, not claimed as achieved or automatically enforced. The research plan still lists obsolete entry_z/exit_z tunables and does not authorize tuning full_size_z/rebalance_band; it needs a Research Lead revision before meaningful continuous-sizing optimization. Optional taper, jump veto, dynamic half-life and Kalman refinements were not added because they broaden scope or conflict with fixed parameters. No backtest or final-exam data was read. The requested outbox file could not be written because this session permits filesystem reads only; the complete bound JSON is returned here.
Verification Results
Verification failed (Layer 1.5 — hypothesis/config consistency) [class=hypothesis_mismatch]: - optimization_plan baseline exit_z is missing or outside its domain
Optional: note the gap risk, or reduce gross_exposure_pct if the drawdown floor binds.
The 6% pair stop is checked only at the daily close and exits at market on the next processing. A gap across one or more sessions can overshoot it materially; the sandbox's largest loss of -$8958 against an average loss of -$1178 is consistent with this. The hypothesis does not specify a stop at all, so this is not a mismatch. Worst case at gross 0.8x: GDX notional is at most 0.8/1.3 ≈ 0.62x equity, so a 6% stop risks about 3.7% of equity before gap overshoot.
Also return early from _manage() when getattr(self, '_no_entries_before_ns', 0) > clock ns, or set _side only after fills are confirmed.
_manage() skips order submission only under _in_warmup. Under the parity replay seed freeze (_no_entries_before_ns), _submit_entry_instrument silently drops the orders, but _side, _entry_* and _q_* are still set. On the next bar the 'flat with side != 0' branch resets _side and starts a cooldown. Replay state can therefore differ from paper by a 3-session cooldown. Normal backtests are unaffected.
Acceptable as written. Optionally log how often the clamp binds.
The estimated beta is clamped to [0.3, 4.0]. When the clamp binds, the residual uses alpha = my - b*mx with the clamped b, so it is no longer the OLS residual. This only matters in degenerate windows and is documented as a structural guard.
Analysis
Iteration History
Outcome Summary
Every parameter named in the research optimization_plan (here exit_z) must exist in the strategy's parameters with a baseline inside its declared domain, or the run cannot get past Layer 1.5 verification.
After 4 iterations it was abandoned in a verification loop, failing Layer 1.5 (hypothesis/config consistency, class hypothesis_mismatch) because the optimization_plan baseline for exit_z was missing or outside its domain.
A dollar/beta-neutral GDX-vs-GLD long-short pair on USEQ daily bars that fades a >=2-sigma 10-session idiosyncratic residual move of gold miners vs gold (rolling OLS beta, z-scored against the prior 250 sessions), with a 15-session time stop.
No performance data exists: the backtest report is empty and no optimization was run, so there are no return, Sharpe or trade figures.
Backtest Review
- Sharpe
- 0.23
- Total return
- 24.48%
- Max drawdown
- 12.19%
- Trades
- 152
- Win rate
- 51.3%
- Profit factor
- 1.19
Backtest and paper results are hypothetical. Trading involves risk of loss.