The Intuition

The Ornstein-Uhlenbeck (OU) process is the continuous-time stochastic model that formalises mean reversion mathematically. Unlike heuristic approaches (Bollinger Bands, RSI), the OU framework estimates the speed of reversion (theta), the long-run mean (mu), and the volatility (sigma) from the data itself, then trades based on deviations from the estimated equilibrium.

The OU process was originally developed in physics to model Brownian motion of particles in a viscous fluid. In finance, Uhlenbeck and Ornstein's mathematics was imported to model interest rates (Vasicek model), commodity prices (where mean reversion to production cost is economically motivated), and any asset with a fundamental anchor. The half-life of reversion — the expected time for the deviation to decay by half — is a key diagnostic: a half-life of 5 days suits high-frequency strategies, while 30–60 days suits weekly or monthly rebalancing.

By fitting the OU parameters on a rolling window, the strategy adapts to changing market regimes. In periods of faster reversion (higher theta), it expects quicker convergence; in slow-reversion regimes, it sizes down or extends holding periods accordingly. This is more principled than fixed-parameter Bollinger Bands.

Key assumptions: (1) The log price series actually follows an OU process — i.e., it is mean-reverting in continuous time. (2) The OLS parameter estimates are stable within the rolling window. (3) The estimated half-life is shorter than the maximum holding period the trader can sustain. If the half-life is very long (months or years), the strategy will not generate meaningful returns on a daily trading basis.

The OU framework is particularly popular in commodities (oil, natural gas), fixed income (yield spread strategies), and currency pairs with fundamental anchors. In equities, mean reversion is weaker — momentum dominates at intermediate horizons. The strategy also struggles when structural breaks shift the long-run mean mu, such as when a company undergoes a major acquisition or sector rotation.

The Math

Read this as a compact model summary: what the signal sees, what it ignores, and where fragility can creep in.

OU process:  dX = theta × (mu - X) × dt + sigma × dW

OLS: X(t) = a + b × X(t-1)
theta     = -log(b)
mu        = a / (1 - b)
half_life = ln(2) / theta

Signal(t) = +1  if (X(t) - mu) / sigma < -threshold
          = -1  if (X(t) - mu) / sigma >  threshold

Parameters

ParameterTypeDefaultDescription
window int 60 Rolling window to estimate OU parameters
threshold float 1.0 Entry threshold in std devs from OU mean

Source Code

def run(ticker: str, start: str, end: str, **params) -> dict:
    window = int(params.get("window", 60))
    threshold = float(params.get("threshold", 1.0))
    df = fetch_ohlcv(ticker, start, end)
    positions, half_life = _signal(df, window, threshold)
    result = run_backtest(df, positions, ticker=ticker, start=start, end=end,
                          strategy=METADATA["slug"],
                          params={"window": window, "threshold": threshold})
    result["half_life"] = round(half_life, 1) if not np.isinf(half_life) else None
    return result

Further Reading

  • Uhlenbeck, G. & Ornstein, L. (1930). On the Theory of Brownian Motion. Physical Review, 36(5).
  • Avellaneda, M. & Lee, J. (2010). Statistical Arbitrage in the US Equities Market. Quantitative Finance, 10(7), 761–782.
  • Chan, E. (2013). Algorithmic Trading, Ch. 2. Wiley.
  • Jurek, J. & Yang, H. (2007). Dynamic Portfolio Selection in Arbitrage. SSRN Working Paper.

When It Works / When It Fails

Works
  • Instruments with demonstrated mean-reversion properties
  • Spread or pairs trades with a short estimated half-life
  • Calm vol environments where OU parameter fit is stable
Fails
  • Trending instruments where the mean is non-stationary
  • Very long half-life — reversion too slow to be practical
  • Vol-stress regimes where OU assumption breaks down

Regime Fit

Transition / Calm vol
Best conditions at 1.0. Range oscillation is stable; OU parameters fit reliably.
Transition / Normal vol
Strong fit at 0.75. OU process still identifiable with slightly wider confidence bands.
Bull or Bear / Calm vol
Reduced to 0.7. Directional drift conflicts with mean-reversion assumption.
Any regime / Stressed vol
Drops to 0.0. Spread can blow out; OU stationarity assumption breaks entirely.

Compared to Alternatives

vs Bollinger
Bollinger uses rolling std from price levels; OU estimates mean-reversion speed and half-life from a fitted SDE. OU is more principled for spread modeling.
vs Zscore
Zscore uses rolling statistics empirically; OU explicitly models reversion speed and provides a principled half-life estimate. OU is model-based; Zscore is purely empirical.
vs Pairs
OU applies to a single mean-reverting series; Pairs uses two-asset cointegration with an OLS hedge ratio. For genuine pair trades, Pairs is more appropriate and is dollar-neutral by construction.
Run This Strategy →