Skip to content

Overlays

Overlays are filters applied after a strategy generates an entry signal. They do not generate signals themselves — they approve, veto, or scale the size of signals that already exist. The overlay pipeline runs inside gordon-strategy::strategy::evaluate_vetoes before any OrderIntent reaches the bus.

Every overlay must prove its lift via isolated ablation before inclusion. An overlay that does not measurably improve walk-forward Sharpe is removed, regardless of how logical it seems in isolation.

Pipeline position

A signal that survives all vetoes becomes an OrderIntent. A vetoed signal is dropped silently (metered via tracing counters, not an error).

Funding z-score

Source: Binance Futures 8h funding rates (market_data.funding_rates).

Logic: Computes a rolling z-score of the funding rate over a configurable lookback window. Extreme positive funding (longs paying shorts) means the market is overheated to the upside. Extreme negative funding signals the opposite.

Application: Contrarian veto at extremes.

  • Funding z-score above the positive threshold: long signals are vetoed.
  • Funding z-score below the negative threshold: short signals are vetoed.
  • Mid-range funding: no veto.

Rationale: Crowded trades tend to unwind violently. Extreme funding is a leading warning sign of a positioning reversal.

OI regime

Source: Binance Futures OI snapshots (market_data.open_interest).

Logic: Classifies the market into four regimes by combining OI delta direction with price delta direction:

OI changePrice changeRegimeSignal implication
RisingRisingNew longs enteringTrend confirmation
RisingFallingNew shorts enteringTrend confirmation (short)
FallingRisingShorts closingWeaker rally (short squeeze)
FallingFallingLongs closingWeaker decline (capitulation)

Application: Regime classification. Signals aligned with "new position" regimes pass. Signals in "closing position" regimes are vetoed or size-reduced depending on the OverlayConfig.

GEX regime

Source: Deribit options data (market_data.gamma_exposure, market_data.gamma_exposure_strikes).

Logic: Gamma exposure measures the net gamma dealers hold. Positive GEX (dealers long gamma) creates a self-stabilizing market — dealers buy dips and sell rallies, dampening moves. Negative GEX (dealers short gamma) creates a reflexive market — moves amplify.

Application: Regime veto. In strong positive GEX regimes, trend-following signals in the direction counter to dealer hedging are vetoed. In negative GEX regimes, signals are confirmed.

Macro regime

Source: FRED macro indicators (market_data.macro_data), consumed by gordon-risk's MacroBreaker.

Application: When the MacroBreaker fires (macro regime deteriorating), gordon-risk issues a risk.commands pause. The overlay-level veto operates at a softer threshold: it scales down position sizes before the full circuit-breaker level is reached.

Vol-targeting SizeHint

Source: Realized volatility computed from recent 1m candles.

Logic:

Adjusted size = base size × (target_vol / realized_vol)
  • Low realized volatility: positions are larger (same SL distance represents less risk).
  • High realized volatility: positions are smaller (same SL distance represents more risk).

Application: Not a veto — adjusts the SizeHint returned alongside the Signal. gordon-bot uses SizeHint to compute the notional before writing the OrderIntent.

Sentiment regime (corr_regime)

Source: Cross-asset correlation density computed from kline data.

Logic: When all assets move together (high correlation density), the market is in a risk-on/risk-off regime. Diversification breaks down and panic-driven short covering distorts signals.

Application: Veto for shorts during high-correlation (panic) regimes. This is the corr_regime overlay — currently the highest-priority port to finalize in the Rust pipeline. It operates on D1 only (daily regime classification, not intrabar).

Rationale: During correlated panic regimes, mean-reversion forces dominate over trend forces. Short entries are particularly susceptible to violent reversals as liquidation cascades trigger stop-hunting.

Sentiment composite components

The broader sentiment regime also incorporates:

Fear & Greed index (alt.me, daily): extreme fear (below 20) increases long position size as a contrarian signal. Extreme greed (above 80) reduces size.

Liquidation risk composite: Combines OI z-score, price proximity to liquidation clusters, and funding direction. All three aligning triggers position size reduction or entry veto.

Stablecoin Supply Ratio (SSR) (DefiLlama, daily): ratio of BTC market cap to total stablecoin supply. Low SSR = buying ammunition available (bullish bias). High SSR = capital already deployed (bearish bias). Applied as a sizing multiplier, not a hard veto.

Validation process

Before any overlay is added to the live pipeline:

  1. Baseline: run the strategy without the overlay, record Sharpe.
  2. Isolated test: add only this overlay, record new Sharpe.
  3. Ablation: if Sharpe improves the overlay has proven lift; if not it is rejected.
  4. Multi-asset check: the improvement must hold across BTC, ETH, and SOL — not just one pair.
  5. Walk-forward check: the improvement must be consistent across temporal windows.

An overlay that improves Sharpe on one pair but degrades it on another is not reliable. One that works on 2020–2021 data but fails on 2022–2023 is regime-fitted. Both are rejected.

OverlayConfig

Each bot's overlay behavior is controlled by OverlayConfig — a struct in gordon-strategy::strategy. Configuration includes per-overlay enable flags, z-score thresholds, lookback windows, and size multiplier bounds. OverlayConfig is serialized into bot_configs.strategy_params and validated by gordon-manager at bot startup via Strategy::params_schema().

Invariants

  • Overlays never generate signals. They only filter or scale signals from a Strategy.
  • Every overlay shipped to production has passed isolated ablation.
  • An overlay whose lift is removed by a regime shift is flagged in the walk-forward check — not silently kept.
  • corr_regime veto applies to D1 regime classification only. Intrabar correlation noise is not evaluated.
  • Vol-targeting produces a SizeHint, not a veto. It cannot silence a signal; it can only scale the size.
  • StrategiesStrategy trait, OverlayConfig, overlay pipeline position.
  • Backtesting — ablation discipline and walk-forward protocol.
  • Risk Management — circuit-breaker level vetoes (harder threshold than overlay vetoes).
  • Data Pipeline — funding rates, OI, GEX, fear&greed, SSR sources.

Gordon — keep compounding without blowing up