Skip to content

v1.17.0 — feat: QPB Entry Gate and Unified Regime-Probability Pipeline

Choose a tag to compare

@rpycgo rpycgo released this 18 Apr 01:47
· 56 commits to main since this release

Highlights

This release introduces two major structural changes that significantly enhance both the profitability and the comparative validity of the system:

  • QPB (Quiet Pre-Breakout) Entry Gate: A new microstructure filtering layer that conditions entries on three simultaneous indicators. On BTC/USDT (2020–2025) evaluation, enabling QPB transforms the baseline PAITS result.
  • Unified Regime-Probability Pipeline: The sticky filter, ADX gate, and the new QPB gate are now consolidated into a shared helper (_regime_gates.assemble_signal). This ensures that mdrs_sde, dl_regime, and hmm_regime are evaluated under identical downstream filtering conditions—a critical requirement for fair model comparison.

What's New

1. QPB Entry Gate

Three microstructure conditions must be simultaneously satisfied at the signal bar for a signal to be executed:

Condition Threshold Interpretation
past_vol_48b < 0.003 4h rolling log-return std (Ensures a short-term calm regime)
aligned_pret_48b < 0.02 Prior 4h return in trade direction (Prevents directional overextension)
d_rv_90d_proxy < 0.55 90d annualised realised vol (Excludes extreme long-term volatility)

2. Preprocessor Outputs

CryptoPreprocessor.run_full_pipeline() now generates three additional columns: past_vol_48b, past_ret_48b, and d_rv_90d_proxy. The daily 90-day vol proxy is lagged by one day to prevent look-ahead bias.


Internal Changes

1. Shared Regime-Probability Pipeline

The new module backtesting.models.adapters._regime_gates centralises the sticky + ADX + QPB pipeline. mdrs_sde, dl_regime, and hmm_regime now all delegate signal assembly to this shared function.

2. HMM Policy Change

hmm_regime now produces a continuous regime probability (the posterior probability of the bullish state) instead of emitting raw per-bar state labels. This makes the HMM model directly comparable to MDRS-SDE and DL-regime models.


⚠️ Breaking Changes & Limitations

Breaking Changes

  • HMM Output Semantics: regime_prob is now the continuous posterior probability. Downstream consumers relying on raw state-labels must update their logic or regenerate signals.
  • Signal Pickle Compatibility: Pickles (--from-signals) generated under v1.16 do not contain QPB features. They must be regenerated if QPB is enabled.

Limitations

  • Asset-Specific Calibration: Shipped thresholds are BTC-specific. Users running ETH, SOL, or XRP should either disable QPB (filters.qpb.enabled = false) or perform asset-specific calibration, as volatility distributions vary significantly across assets.
  • Trade Count Trade-off: The gate reduces trade frequency by approximately 78% to achieve higher signal quality.