Hurst Exponent
Is this market trending, mean-reverting, or random?
One number that tells you what kind of market you're in. Above 0.5 = trends keep going (use trend bots). Below 0.5 = prices keep snapping back (use reversion bots). Around 0.5 = random, no edge today, save your money.
Hurst is one number that tells you what kind of market you're in. >0.5 = the trend keeps going (use trend bots). <0.5 = price keeps snapping back (use reversion bots). =0.5 = random, no edge. Computed via R/S analysis over a rolling window. The single most useful regime classifier we have.
H from R/S analysis. >0.5 trends, <0.5 reverts, =0.5 random
Real Hurst Exponent bot, running on real Yahoo data when the symbol is available. Drag the params — the bot re-runs instantly.
This is the actual code the bot runs — not a re-explanation, not a simplified version. Whatever ships here is what executes when you press Run All in the workbench. Read it, copy it, fork it, build a better one.
const hurstBot: BotDef = {
id: "hurst",
name: "Hurst Exponent",
category: "stats",
glyph: "H",
tagline: "Is this market trending, mean-reverting, or random?",
formula: "H from R/S analysis. >0.5 trends, <0.5 reverts, =0.5 random",
params: [
{ key: "window", label: "Window", kind: "number", default: 128, min: 64, max: 256, step: 8 },
],
run: (ctx): BotResult => {
const px = closes(ctx.candles);
const h = hurst(px);
let regime: "trend" | "revert" | "random" = "random";
if (h > 0.55) regime = "trend";
else if (h < 0.45) regime = "revert";
return {
signals: [],
metrics: [
{ key: "h", label: "H", value: fmtNum(h, 3), tone: regime === "trend" ? "bull" : regime === "revert" ? "warn" : "neutral" },
{ key: "regime", label: "Regime", value: regime.toUpperCase(), tone: regime === "trend" ? "bull" : regime === "revert" ? "warn" : "neutral" },
{ key: "edge", label: "Edge", value: regime === "random" ? "NONE" : "YES", tone: regime === "random" ? "warn" : "bull" },
],
summary: `H = ${h.toFixed(3)} → ${regime} regime.`,
beginner:
"Hurst is one number that tells you what kind of market you're in. >0.5 = the trend keeps going (use trend bots). <0.5 = price keeps snapping back (use reversion bots). =0.5 = random, no edge.",
verdict: {
side: "hold",
text:
regime === "trend"
? "Trend regime — momentum bots have edge here."
: regime === "revert"
? "Reversion regime — mean-reversion bots have edge here."
: "Random walk — no statistical edge today.",
confidence: Math.abs(h - 0.5) * 2,
},
};
},
};id— unique key the workbench uses to find the bot.params— the sliders + inputs you see on the cell.run(ctx, p)— the function that gets called with candles + your params and returns the verdict.verdict— the BUY / SELL / HOLD pill at the top of the cell.metrics— the small stat boxes shown in the cell body.
- Copy the whole block above.
- On /quant, click + Import your bot in the bot library.
- Paste, hit save. It hot-loads into your workspace.
- Edit any param defaults or logic to your taste — it's now yours.
- ·Bot selection. Don't run an SMA Crossover when Hurst is 0.4 — you'll get killed. Run a Z-Score bot instead.
- ·Sizing. When Hurst > 0.6, trend bots earn their keep — size up. When 0.45-0.55, scale down.
- ·Asset comparison. Lay Hurst against multiple symbols and rank by trendiness.
- ·Short windows. R/S analysis needs lots of data — 128 bars is the floor. Below that, Hurst estimates have huge variance.
- ·Regime transitions. Hurst is a slow indicator; by the time it confirms a regime, you've missed half the move.
- ·Microstructure noise. On minute data, Hurst converges to ~0.5 because of bid-ask bouncing.
Always HOLD — Hurst doesn't trade, it classifies. The 'regime' chip (TREND / RANDOM / REVERT) is what you act on. Use it to gate which other bots you trust on this asset.
What's R/S analysis?+
Why does Hurst sometimes give crazy values like 0.8?+
Buy when fast moving average crosses above slow.
Bet on snap-back when the price wanders too far.
Adaptive fair-value tracker. Smooth and self-correcting.
Linear regression line + std-deviation envelopes.