What is the Hurst exponent?
Named after the British hydrologist Harold Edwin Hurst (1951), who developed it while studying Nile water levels; later carried into financial mathematics (fractals) by Benoît Mandelbrot. The Hurst exponent H ∈ [0, 1] answers a question that ADX does not: does the series have memory?
| H | Meaning |
|---|---|
| > 0.5 | persistent / trending — a move tends to be followed by one in the same direction |
| ≈ 0.5 | random walk — no exploitable structure |
| < 0.5 | anti-persistent / mean-reverting — a move tends to be followed by a counter-move |
Computation in Botty (variance-ratio method)
Botty uses a fast, vectorized variance-ratio estimate (not the classic R/S analysis), mathematically equivalent to the per-tick variant:
log_ret1 = log(close / close.shift(1)) # 1-bar returns
log_retk = log(close / close.shift(lag)) # k-bar returns
H = log( var(log_retk) / var(log_ret1) ) / (2 · log(lag))
Idea: if variance scales faster than linearly with the horizon → trend (H>0.5). If it scales more slowly → mean reversion (H<0.5). For a random walk the variance grows exactly linearly → H=0.5.
How Botty uses the Hurst exponent
data/indicator_cache.py::_compute_hurst(df, window, lag)— rolling H series, O(n).strategies/conditions/filters.py→hurst_regime_filter: only allows entries when H ≥hurst_min(default 0.55) — suppresses EMA-crossover false signals in ranges.- As a comparison lens to ADX in the regime context (see Detecting & predicting market regimes: ADX/DMI is only one lens among many).
Strengths & limits
✅ Directionless and model-free — a second, independent opinion on the ADX trend question. ✅ Distinguishes trending from mean-reverting (ADX only says "strong/weak").
❌ The estimate is window-dependent and noisy over short windows. ❌ Lagging like all rolling measures; not a precise timing trigger.