LIVE·
fetching live quotes from Yahoo Finance…
--:--:--UTC
Learn/Bots/Hurst Exponent
Statisticalid · hurst
H

Hurst Exponent

Is this market trending, mean-reverting, or random?

In plain English

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.

No jargon. Just what this bot does.
The longer version

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.

The math
formula
H from R/S analysis. >0.5 trends, <0.5 reverts, =0.5 random
parameters
windowWindowrange 64 → 256default · 128
Live demo

Real Hurst Exponent bot, running on real Yahoo data when the symbol is available. Drag the params — the bot re-runs instantly.

symbolloading…
loading AMZN bars…
Source code · public

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.

lib/quant/bots.ts·lines 428466
TypeScript · MIT-licensed
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,
      },
    };
  },
};
what each piece means
  • 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.
use this code yourself
  1. Copy the whole block above.
  2. On /quant, click + Import your bot in the bot library.
  3. Paste, hit save. It hot-loads into your workspace.
  4. Edit any param defaults or logic to your taste — it's now yours.
Specialty · when it shines, when it fails
✓ Shines when
  • ·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.
✗ Fails when
  • ·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.
How to read its verdict

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.

FAQ
What's R/S analysis?+
Rescaled Range. For windows of size n inside the data, compute the range divided by std. Plot log(R/S) against log(n) — the slope is the Hurst exponent. It's a measure of self-similarity in the time series.
Why does Hurst sometimes give crazy values like 0.8?+
Either real strong trend (BTC 2020), or short window producing unstable estimates, or strong autocorrelation that breaks the R/S assumption. Always cross-check with at least 256 bars before trusting an extreme reading.