Skip to content

Regime-conditional resampling for Monte Carlo (volatility clustering) #531

Description

@MDUYN

Context

Current Monte Carlo / permutation testing implicitly assumes returns are i.i.d. when shuffling. Real markets exhibit:

  • Volatility clustering (GARCH-like behavior)
  • Regime shifts (trending vs. mean-reverting, low-vol vs. high-vol)
  • Fat tails concentrated in specific regimes

Naive resampling destroys these properties and produces optimistic tail-risk estimates.

Goal

Add a regime-aware resampling mode for both single-strategy and portfolio-level Monte Carlo (see #530) that respects volatility clustering and regime structure.

Approaches to evaluate

  1. Block bootstrap with adaptive block length (preserves local volatility structure)
  2. Markov-switching regime detection (e.g. 2–3 state HMM on volatility) → resample within regime, preserve regime transition matrix
  3. GARCH-filtered resampling: fit GARCH, resample standardized residuals, reconstruct returns
  4. Volatility-bucketed resampling: classify bars into vol quantiles, resample within bucket

Acceptance criteria

  • New resampling option on existing MC / permutation API
  • At least one regime-aware method implemented (block bootstrap with adaptive block length is the pragmatic starting point)
  • Diagnostic output: detected regimes / block length / GARCH fit quality
  • Docs section explaining when regime-conditional MC matters and which method to pick

Related

Notes

Driven by community discussion on the 1k-stars LinkedIn post. Practitioners running large EA parameter sweeps (millions of combinations on tick data) consistently report that i.i.d. MC underestimates real-world drawdowns.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions