Ornstein-Uhlenbeck Mean Reversion
Fit an OU process to log prices and trade when deviation exceeds the threshold.
Understand what this strategy is actually betting on before you touch the parameter panel.
Read the model brief like a skeptic
Strategy families & selection
Validation & skepticism
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
| Parameter | Type | Default | Description |
|---|---|---|---|
| window | int | 60 | Rolling window to estimate OU parameters |
| threshold | float | 1.0 | Entry threshold in std devs from OU mean |
Source Code
Live source — fetched from engine/strategies/ou_reversion.py
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.
Related Mean Reversion Strategies
Use nearby strategies to compare the same market hypothesis under different signal constructions.