/tradecraft:hurst-exponent-dynamics-crisis-predictionfrom tradecraft
Implements Mark Vogel's Oxford ISF research on rolling-window Hurst exponent dynamics of wavelet-denoised S&P 500 returns (2000-2020) for crisis detection. Covers chaos analysis, cascadic wavelet denoising, recurrence quantification, multifractal DFA, and momentum crash prediction via fractal-trend-to-mean-reversion regime shifts.
Ships in tradecraft. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Skill: Hurst Exponent Dynamics & Financial Crisis Prediction | Domain: trading/quantitative-analysis | Category: Nonlinear Dynamics | Level: expert Tags:
hurst-exponent,chaos-theory,wavelet-analysis,multifractal,crisis-prediction,momentum-crash
Source: Mark Vogel (VoglData) -- 42nd International Symposium on Forecasting, Oxford University, July 11, 2022. Academic research on Hurst exponent dynamics of cascadic wavelet filtered S&P 500 logarithmic returns (2000-2020). ~200,000 papers sampled quantitatively to extract state of the art across nonlinear dynamics, chaos theory, quantitative finance, and KF theory.
Mandelbrot's classical interpretation states that H > 0.5 reveals long memory in the data. This research contradicts that conception:
| H Value | Classical (Mandelbrot) | Revised (Vogel et al.) |
|---|---|---|
| H = 0.5 | Random walk / stochastic | Stochastic / martingale (EMH valid) |
| H > 0.5 | Long memory / persistence | Fractal trending (momentum) |
| H < 0.5 | Anti-persistence / mean reversion | Mean-reverting process |
Key implication: All rolling-window Hurst exponents tested were significantly different from 0.5 (bootstrapped with 50,000 iterations), meaning the EMH is systematically violated.
Designed for non-stationary financial data. Each step addresses a specific analytical need.
Original data: daily S&P 500 log returns (denoised via cascadic wavelet filter)
Step size: 1 (overlapping, maximum data points)
Window sizes: 100, 1000, 2500 days
Significance: 50,000-step bootstrapping (all significantly != 0.5)
| Window | Captures | Characteristics |
|---|---|---|
| H-100 | Long-term development | Short memory (exponentially decaying autocorrelation) |
| H-1000 | Medium-term structure | True long memory (slow-decaying autocorrelation) |
| H-2500 | Short-term development | True long memory (slow-decaying autocorrelation) |
All three series are autoregressive-like processes with stacked properties:
This is the novel contribution -- not found in prior literature.
The heatmap shows average frequency-per-scale behavior of S&P 500 returns over time. Cross-referencing with Hurst exponent behavior:
CRISIS SIGNATURE (e.g., Subprime Crisis):
1. Hurst exponent rises sharply (strong fractal trending / momentum)
2. CWT frequency information becomes strongly positive and significant
3. SUDDEN DROP: Hurst falls into mean-reversion territory (H < 0.5)
4. CWT frequencies drop back to negative
=> This transition IS the momentum crash
| Window | Crisis Resolution | Trade-off |
|---|---|---|
| H-100 | Highest resolution, clearest crisis signals | More noise |
| H-1000 | Visible interconnection on frequency level | Smearing effects |
| H-2500 | Long-term regime shifts visible | Significant loss of resolution |
The theoretical chain linking chaos theory to tradeable momentum:
Dissipative chaotic system (phase space deflates)
|
v
Strange attractor (data lives on this structure)
|
v
Poincare section of attractor = fractal set
|
v
Fractal set requires scaling laws (power laws)
|
v
Scaling exponents extractable via MF-DFA
|
v
Fractal trends measurable by Hurst exponent
|
v
Fractal trends CAUSE momentum effect
|
v
Momentum crash = transition from H > 0.5 to H < 0.5
Conclusion: Hurst exponent dynamics are non-chaotic even though they stem from a chaotic system. They can directly evaluate EMH validity and detect regime transitions.
The research tested multiple forecasting approaches on Hurst exponent series:
| Method | Result | Notes |
|---|---|---|
| Fractional Brownian Motion | Only acceptable for H-100 | Moving-average-like, within error metrics |
| Standard AR/ARMA models | Failed | Cannot reproduce complex stochastic DGP |
| LSTM deep learning | Failed | Dislikes sharp, frequently-switching data |
| MLP neural networks | Failed | Same sensitivity to switching dynamics |
| Wavelet neural networks | Failed | Replacing activation with wavelet function did not help |
| Multifractal Brownian Motion | Failed | Stacked errors from Hurst estimation + chaotic error growth |
Root causes of failure:
import numpy as np
import pandas as pd
from typing import Tuple, List, Optional
def hurst_rs(series: np.ndarray) -> float:
"""
Rescaled Range (R/S) Hurst exponent estimator.
H > 0.5: fractal trending (momentum)
H = 0.5: random walk (EMH valid)
H < 0.5: mean-reverting
"""
n = len(series)
if n < 20:
return 0.5
max_k = int(np.floor(n / 4))
sizes = []
rs_values = []
for k in range(10, max_k + 1):
num_segments = n // k
rs_seg = []
for i in range(num_segments):
segment = series[i * k:(i + 1) * k]
mean_seg = np.mean(segment)
deviate = np.cumsum(segment - mean_seg)
r = np.max(deviate) - np.min(deviate)
s = np.std(segment, ddof=1)
if s > 0:
rs_seg.append(r / s)
if rs_seg:
sizes.append(k)
rs_values.append(np.mean(rs_seg))
if len(sizes) < 2:
return 0.5
log_sizes = np.log(sizes)
log_rs = np.log(rs_values)
coeffs = np.polyfit(log_sizes, log_rs, 1)
return coeffs[0]
def rolling_hurst(returns: np.ndarray, window: int = 100, step: int = 1) -> np.ndarray:
"""
Compute rolling-window Hurst exponents (step=1 for maximum resolution).
Windows: 100 (long-term dev), 1000 (medium), 2500 (short-term dev).
"""
n = len(returns)
indices = range(window, n + 1, step)
h_values = np.full(len(indices), np.nan)
for i, end in enumerate(indices):
segment = returns[end - window:end]
h_values[i] = hurst_rs(segment)
return h_values
def bootstrap_hurst_significance(
returns: np.ndarray,
window: int = 100,
n_bootstrap: int = 50000,
alpha: float = 0.05
) -> dict:
"""
Bootstrap test: is observed Hurst significantly different from 0.5?
Generates n_bootstrap shuffled surrogates (destroying temporal structure)
and compares observed H to the null distribution.
"""
observed_h = hurst_rs(returns[:window])
null_dist = np.zeros(n_bootstrap)
for b in range(n_bootstrap):
shuffled = np.random.permutation(returns[:window])
null_dist[b] = hurst_rs(shuffled)
p_value = np.mean(np.abs(null_dist - 0.5) >= np.abs(observed_h - 0.5))
ci_lower = np.percentile(null_dist, 100 * alpha / 2)
ci_upper = np.percentile(null_dist, 100 * (1 - alpha / 2))
return {
"observed_h": round(observed_h, 4),
"p_value": round(p_value, 6),
"significant": p_value < alpha,
"null_ci": (round(ci_lower, 4), round(ci_upper, 4)),
"interpretation": (
"FRACTAL TRENDING (momentum)" if observed_h > ci_upper else
"MEAN REVERTING" if observed_h < ci_lower else
"STOCHASTIC (EMH consistent)"
)
}
def detect_regime_shift(
h_series: np.ndarray,
threshold_high: float = 0.6,
threshold_low: float = 0.45,
lookback: int = 5
) -> dict:
"""
Detect Hurst regime transitions that precede momentum crashes / crises.
Pattern: H rises sharply above threshold_high, then drops below threshold_low.
"""
if len(h_series) < lookback + 1:
return {"regime": "INSUFFICIENT_DATA", "crisis_warning": False}
current_h = h_series[-1]
recent_max = np.max(h_series[-lookback - 1:-1])
recent_min = np.min(h_series[-lookback - 1:-1])
recent_slope = (h_series[-1] - h_series[-lookback]) / lookback
# Crisis signature: was trending (high H), now dropping toward mean reversion
crisis_warning = (recent_max > threshold_high and
current_h < recent_max - 0.1 and
recent_slope < -0.01)
if current_h > threshold_high:
regime = "STRONG_FRACTAL_TREND"
elif current_h > 0.5:
regime = "WEAK_TREND"
elif current_h > threshold_low:
regime = "STOCHASTIC"
else:
regime = "MEAN_REVERTING"
return {
"regime": regime,
"current_h": round(current_h, 4),
"recent_max_h": round(recent_max, 4),
"h_slope": round(recent_slope, 6),
"crisis_warning": crisis_warning,
"interpretation": (
"MOMENTUM CRASH WARNING: H dropping from trend to mean-reversion"
if crisis_warning else
f"Current regime: {regime}"
)
}
def wavelet_denoise(series: np.ndarray, wavelet: str = 'db9', level: int = 4) -> np.ndarray:
"""
Cascadic wavelet denoising (prerequisite for valid nonlinear analysis).
Uses Daubechies-9 wavelet as in the original research.
Requires pywt: pip install PyWavelets
"""
import pywt
coeffs = pywt.wavedec(series, wavelet, level=level)
# Threshold detail coefficients (universal threshold)
sigma = np.median(np.abs(coeffs[-1])) / 0.6745
threshold = sigma * np.sqrt(2 * np.log(len(series)))
denoised_coeffs = [coeffs[0]] # Keep approximation
for c in coeffs[1:]:
denoised_coeffs.append(pywt.threshold(c, threshold, mode='soft'))
return pywt.waverec(denoised_coeffs, wavelet)[:len(series)]
def full_hurst_crisis_pipeline(
prices: pd.Series,
windows: List[int] = [100, 1000, 2500],
denoise: bool = True
) -> dict:
"""
Complete pipeline: prices -> log returns -> denoise -> rolling Hurst -> regime detection.
"""
log_returns = np.diff(np.log(prices.values))
if denoise:
log_returns = wavelet_denoise(log_returns)
results = {}
for w in windows:
if len(log_returns) < w:
continue
h_series = rolling_hurst(log_returns, window=w)
regime = detect_regime_shift(h_series)
results[f"H-{w}"] = {
"hurst_series": h_series,
"latest_h": round(h_series[-1], 4) if len(h_series) > 0 else None,
"mean_h": round(np.nanmean(h_series), 4),
"std_h": round(np.nanstd(h_series), 4),
"regime": regime
}
return results
Monitor rolling Hurst exponents across multiple windows. When H-100 shows a sharp drop from strong trending (H > 0.65) toward mean reversion (H < 0.50), this signals an impending momentum crash -- reduce trend-following exposure immediately.
H > 0.6 => Deploy trend-following / momentum strategies
H ~ 0.5 => Market is random-walk-like; reduce exposure or use delta-neutral
H < 0.45 => Deploy mean-reversion strategies (Bollinger, RSI extremes)
Before deploying any strategy, check whether the current Hurst regime supports the strategy type. Trend-following in a mean-reverting regime (or vice versa) will produce systematic losses.
CWT heatmaps during crisis transitions show exploitable frequency components. Medium/long-window Hurst series (H-1000, H-2500) contain frequency information that can inform systematic entry/exit timing.
| Skill | Integration |
|---|---|
market-regime-classifier | Use Hurst regimes as input features for ML regime classification |
statistics-timeseries | Foundation for stationarity tests, autocorrelation analysis |
fast-fourier-transform | Complement CWT frequency analysis with FFT for exploitable cycles |
kalman-filter | Online Hurst estimation with state-space models |
capitulation-mean-reversion | Trigger capitulation scans when Hurst drops from trend to mean-reversion |
momentum-roc-strategy | Validate momentum signals against Hurst fractal-trend confirmation |
market-regime-classifier | Cross-validate regime shifts from Hurst with other regime detectors |
HURST EXPONENT DYNAMICS -- CRISIS PREDICTION FRAMEWORK
=======================================================
SOURCE: Vogel, Oxford ISF 2022 | DATA: S&P 500 log returns 2000-2020
KEY FINDING: H > 0.5 = fractal trends (NOT long memory as Mandelbrot claimed)
PIPELINE:
Raw prices -> Log returns -> Wavelet denoise (db9) -> Rolling Hurst (100/1000/2500)
-> Bootstrap significance (50k)
-> CWT heatmap for crisis detection
REGIME MAP:
H > 0.60 STRONG FRACTAL TREND => Momentum strategies, ride trends
H ~ 0.50 STOCHASTIC => EMH-like, reduce exposure
H < 0.45 MEAN REVERTING => Mean-reversion strategies
CRISIS SIGNATURE:
1. H rises sharply (strong momentum phase)
2. H DROPS suddenly toward 0.5 or below
3. CWT frequencies flip from positive to negative
=> MOMENTUM CRASH / FINANCIAL CRISIS IN PROGRESS
WHAT DOES NOT WORK FOR FORECASTING H:
- LSTM / MLP / wavelet neural networks (hate switching regimes)
- Standard ARMA (too simple for the DGP)
- Multifractal Brownian Motion (stacked error propagation)
- Only fractional Brownian Motion on H-100 gives acceptable results
CHAOS-TO-MOMENTUM CHAIN:
Chaotic system -> Strange attractor -> Poincare section (fractal)
-> Scaling/power laws -> MF-DFA exponents -> Hurst measures fractal trends
-> Fractal trends = momentum effect -> H regime shift = momentum crash
BOOTSTRAPPING:
50,000 shuffled surrogates | All windows significantly != 0.5
=> EMH systematically violated across 20 years of S&P 500 data
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mahmoud20138/tradecraft --plugin tradecraft169 skills in this plugin
/agent-developmentThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins./agentic-storageAgentic storage architecture — persistent memory for AI agents using MCP, immutable versioning, sandboxing, and intent validation. Covers the stateless problem in LLM agents, RAG limitations (read-only), MCP protocol (JSON-RPC, resources, tools), storage safety layers, and agent file system design. Source: IBM Technology (Martin Keen), March 2026. Use this skill for "agentic storage", "agent memory", "persistent agent state", "MCP storage", "agent file system", "agent hard drive", "stateless agent problem", "agent work product", "immutable versioning", "agent sandboxing", "intent validation", "agent safety layers", "agent context window limits", "storage for AI agents", "agent persistence", "autonomous agent storage", "agent audit trail". Works with mcp-integration, trading-brain, agents, trade-psychology-coach.
Other plugins' skills for the same job