Skip to content
All strategies

Strategies

Gold Safe-Haven Window After US Equity Shock Days: Long XAUUSD.SPOTMETAL for N Sessions After a >=k-Sigma SPY Down Session, Optional Haven-Unwind Short Leg (Cross-Venue Signal SPY.USEQ -> Spot Gold, 1-DAY, Long-Short)

Outcome: Verifying

GoldHavenAfterSpyShock

Gold Safe-Haven Window After US Equity Shock Days: Long XAUUSD.SPOTMETAL for N Sessions After a >=k-Sigma SPY Down Session, Optional Haven-Unwind Short Leg (Cross-Venue Signal SPY.USEQ -> Spot Gold, 1-DAY, Long-Short)

Hypothesis

Derived by the Research Lead from the safe-haven literature (Baur & Lucey 2010, 'Is Gold a Hedge or a Safe Haven?'; Baur & McDermott 2010): gold earns positive returns in the days right after extreme stock-market losses, and that haven bid fades and partly reverses after about 15 trading days. Operationalization: the SIGNAL comes from SPY.USEQ daily bars (16:00 ET close). The TRADE is XAUUSD.SPOTMETAL spot gold on 1-DAY bars (trading day closes 17:00 New York). Both are session venues. A SPY shock known at 16:00……Show moreShow less

Derived by the Research Lead from the safe-haven literature (Baur & Lucey 2010, 'Is Gold a Hedge or a Safe Haven?'; Baur & McDermott 2010): gold earns positive returns in the days right after extreme stock-market losses, and that haven bid fades and partly reverses after about 15 trading days. Operationalization: the SIGNAL comes from SPY.USEQ daily bars (16:00 ET close). The TRADE is XAUUSD.SPOTMETAL spot gold on 1-DAY bars (trading day closes 17:00 New York). Both are session venues. A SPY shock known at 16:00 ET is acted on at gold's next bar OPEN (18:00 NY session reopen), the platform's supported next_open_fill rule. No lookahead: the SPY bar is stamped at 16:00 ET, before the 17:00 NY gold bar close that triggers the decision. On a SPY 'shock-down' session (SPY close-to-close return <= -shock_z times its trailing 60-session return std, with the std computed from the sessions BEFORE the shock), buy spot gold at the next gold open and hold for long_hold_sessions gold trading days. If reversal_leg = on, then when the long hold ends, flip short for reversal_hold_sessions days to capture the documented haven unwind. A new shock during a hold restarts the long clock (it does not add size). A new shock during the reversal leg closes the short and goes long again. Why this instrument: XAUUSD.SPOTMETAL has 9 experiments in the corpus and data back to 2003, so this spends unused data. SPY is used only as a signal source and is never traded. Cross-venue and long-short both fill under-represented quota buckets. It is mechanically different from the prior gold failures: GLD momentum confluence, Asia drift, the London breakout and PAXG premium were all gold-only price patterns, while this is a cross-asset event trigger. Data note: the 1-DAY spot gold catalog is currently backfilled from 2003 to 2007, and the rest is collected on demand from Dukascopy. The backtest needs the full 2003-2026 span. Risk control is route (a) plus (b): signal/time exits, a fixed 50% of equity notional (unlevered), and an intrabar protective stop at 4% adverse from entry (2% of equity at the stop). The stop triggers inside the bar in the platform's simulated venue and live mirrors those fills; no exchange-resting order is required.

Implementation

Cross-venue event strategy. Signal: the SPY.USEQ daily close-to-close return divided by its trailing 60-session return std, where the std uses only the sessions BEFORE the current one (shock score = -ret/std). Trade: XAUUSD.SPOTMETAL on 1-DAY bars. When a SPY session's score is >= shock_z, the strategy buys spot gold at the next gold session open (platform next_open_fill) with 50% of equity notional, unlevered, and holds for long_hold_sessions gold sessions. A new shock during the long restarts the clock and adds no size. With reversal_leg='on', the long is flipped into a short with ONE market order at the end of the hold, and the short is held for reversal_hold_sessions. A new shock during the short flips back to long. Each position carries a reduce-only intrabar STOP_MARKET 4% from its average entry price, which is 2% of equity at the stop. It is re-armed on every opening or reversing fill. calculate_signal returns the latest SPY shock score as a continuous value.

Implements the Baur & Lucey / Baur & McDermott safe-haven window as written in the hypothesis and optimization_plan. Parameter names match the plan: shock_z, long_hold_sessions, reversal_leg (categorical 'off'/'on'), reversal_hold_sessions are tunable; vol_lookback=60, stop_loss_pct=0.04, notional_fraction=0.5 and leverage=1.0 are fixed. There are no code clamps, so there are no _param_bounds. Point-in-time alignment: SPY's daily bar closes at 16:00 ET and gold's at 17:00 NY, so the two never share a timestamp.……Show moreShow less

Implements the Baur & Lucey / Baur & McDermott safe-haven window as written in the hypothesis and optimization_plan. Parameter names match the plan: shock_z, long_hold_sessions, reversal_leg (categorical 'off'/'on'), reversal_hold_sessions are tunable; vol_lookback=60, stop_loss_pct=0.04, notional_fraction=0.5 and leverage=1.0 are fixed. There are no code clamps, so there are no _param_bounds. Point-in-time alignment: SPY's daily bar closes at 16:00 ET and gold's at 17:00 NY, so the two never share a timestamp. The base same-timeframe barrier is therefore disabled for the SPY leg (the set is cleared in place, as the AH dual-listing strategy does). A SPY observation is consumed only by the first gold bar whose timestamp is >= the SPY bar's, so there is no lookahead. If several SPY sessions arrive before a gold bar, the largest shock among them counts. Execution: the decision is made at the gold bar close and fills at the next gold session open (supported next_open_fill). The intrabar stop is a reduce-only _submit_stop_market (supported intrabar_stop), with no emulation_trigger. The reversal uses a single order sized |position| + target, and the old stop is cancelled first, which avoids the unsafe reversal pair. Hold counters are scalar attributes counted in gold sessions after the fill. Expected frequency: a 2-sigma down day in SPY happens roughly 8-12 times a year, giving about 200+ entries over 2003-2026 (fewer after clock restarts merge clustered shocks). Risk control: route (a), a 2% equity loss at the stop, plus route (b), time exits with sizing capped at 50% of equity.

Backtest and paper results are hypothetical. Trading involves risk of loss.