Understand mean-reversion quant models
What Is Mean Reversion?
Three pillars:
- Stationary process: The mean and variance don't drift wildly over time (unlike a trending stock that keeps climbing).
- Reverting force: Economic forces (profit-taking, value buyers) pull prices back.
- Quantifiable deviation: We measure "how far is too far" using standard deviations (z-scores) or Bollinger Bands.
The Mathematical Foundation: Ornstein-Uhlenbeck Process
Mean reversion is modeled by the Ornstein-Uhlenbeck (OU) process, the continuous-time version of an autoregressive process.
Derivation from First Principles
Step 1: Model the price change as two competing forces:
- Drift toward mean: The term says "if , drift down; if , drift up." The farther from , the stronger the pull.
- Random shock: is the unpredictable noise (news, liquidity shocks).
Why this step? We separate systematic reversion (predictable) from random walk (unpredictable).
Step 2: Solve for the expected value (where will the price be on average?).
Ignoring the stochastic term for the expectation, we have:
This is a first-order linear ODE. Rearrange:
Integrate both sides:
At , , so .
Exponentiate:
Why this step? We're solving how the expected price evolves. The exponential decay means deviations shrink over time.
Step 3: Rearrange to get the forecast:
Why this step? This formula is our trading signal. If current price deviates from , we know the expected direction and can size our bet.
Practical Implementation: Z-Score Strategy
The OU process is continuous-time. In practice, we work with discrete returns.
Trading Rules:
- Entry: If (price is 2 SD below mean), BUY (expect reversion up).
- Entry: If (price is 2 SD above mean), SELL/SHORT (expect reversion down).
- Exit: Close position when crosses back to0 (price returns to mean).
- Stop-loss: If (regime change? model breakdown?), exit to limit losses.
Why SD? Assuming normal distribution, ~95% of data falls within 2 SD. Breaching this is rare → high probability of reversion. But we must confirm stationarity.

Example1: Single-Stock Mean Reversion
Setup: Stock XYZ has been trading around for months. Today, bad earnings → price drops to . Historical volatility .
Step 1: Compute z-score.
Why this step? We quantify how extreme the deviation is. is 3 SD below mean, highly unusual.
Step 2: Decision triggers a BUY signal. We expect reversion to .
Why this step? The model says extreme deviations are temporary. We're betting the panic is overdone.
Step 3: Estimate time to revert. If we estimated per day (from historical fitting), half-life:
In ~2-3 days, we expect half the deviation to close. Target exit: , price around .
Why this step? Knowing the reversion speed helps set holding period and profit expectations.
Outcome: Three days later, stock rebounds to as earnings panic fades. . Exit for gain.
Example 2: Pairs Trading (Relative Mean Reversion)
Setup: Stocks A and B are in the same sector (e.g., Coca-Cola vs. Pepsi). Historically, their ==price spread == hovers around . Today, , , so . .
Step 1: Compute z-score of the spread.
Why this step? The spread is 3.5 SD above normal. A has outperformed B excessively.
Step 2: Trade the pair to bet on convergence.
- Short A (overpriced relative to B).
- Long B (underpriced relative to B).
- This is market-neutral: if the whole sector drops, we lose on B but gain on the short A. We only care about the spread narrowing.
Why this step? By trading the ratio, we isolate mean-reversion and hedge out market risk.
Step 3: Exit when (spread returns to ). Say , . Spread = 5.
Profit calculation:
- Short A: Sold at 50, bought back at 48 → gain per share.
- Long B: Bought at 38, sold at 43 → gain per share.
- Net (assuming equal position sizes): per unit pair.
Why this step? Pairs trading profits from relative mispricing, not absolute direction.
Testing for Mean Reversion: The ADF Test
Not all price series revert. A trending stock is non-stationary. We use the Augmented Dickey-Fuller (ADF) test.
Why this step? Applying mean-reversion to a trending stock loses money (you keep shorting an uptrend). ADF prevents this.
Common Mistakes
Active Recall Checkpoints
Recall Feynman Explain-to-a-12-Year-Old
Imagine you have a toy that always wants to stay in the middle of your room. If you push it to the corner, it rolls back to the center by itself. That's mean reversion!
Stock prices are like that toy sometimes. When bad news pushes a price way down, it's like the toy is in the corner. Our model says, "Hey, this is too far from the middle—it'll probably roll back." So we buy the stock when it's in the corner, then sell when it rolls back to the middle and make money.
But we have to check: Is the toy really programed to go back to the middle, or did someone move the middle? If the company is actually broken (like the toy's battery died), it won't come back, and we lose. That's why we test with the ADF test to make sure the "rolling back" pattern is real.
Connections
- Statistical Arbitrage Strategies – mean reversion is the engine behind stat-arb
- Bollinger Bands – practical visualization of mean ± 2 SD thresholds
- Cointegration Testing – pairs trading requires cointegration, not just correlation
- Kalman Filter – advanced: dynamically estimate time-varying and
- Risk Management in Quant Trading – position sizing using z-score magnitude
- Stationarity Tests (ADF, KPSS) – prerequisites before trusting mean-reversion signals
#flashcards/stock-market
What is the core assumption of mean-reversion models? :: Prices that deviate significantly from their historical mean are experiencing temporary overeactions and will revert back toward the mean over time.
Write the Ornstein-Uhlenbeck SDE and explain each term.
What does a z-score measure in mean-reversion trading?
When do you BUY in a z-score mean-reversion strategy?
What is the half-life of mean reversion and how is it calculated?
Why use the ADF test before applying mean-reversion?
What is pairs trading and how does it use mean reversion?
What is the key risk of mean-reversion models? :: Regime shifts—when the fundamental mean permanently changes due to company deterioration, market structure change, or crisis. The price won't revert to the old mean.
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Mean reversion ka matlab hai ki jab stock price apne average se bahut zyada door chali jati hai—ya to bahut upar ya bahut neeche—to woh wapas average ki taraf ane ki koshish karti hai. Socho agar ek rubber band ko stretch karo, to woh snap karke wapas relax position mein aa jata hai. Yahi concept markets mein bhi kaam karta hai.
Quant models isko statistically measure karte hain. Hum calculate karte hain ki current price apne historical mean se kitne "standard deviations" door hai (isko z-score kehte hain). Agar z-score -2 se neeche ho (matlab price bahut gir gayi hai), to model kehta hai "buy karo, kyunki yeh wapas upar ayegi." Agar z-score +2 se upar ho (price bahut upar chali gayi), to "sell karo, neeche aayegi." Lekin sabse important cheez hai yeh confirm karna ki stock actually mean-reverting hai ya nahi—uske liye ADF test use karte hain. Agar test fail ho jaye, matlab stock trend kar raha hai aur mean reversion kaam nahi karega.
Pairs trading ek popular strategy hai jisme do similar stocks lete hain (jaise Coca-Cola aur Pepsi). Unka price difference (spread) track karte hain. Jab spread abnormally wide ho jaye, to overpriced wale ko short karo aur underpriced waale ko long karo. Jab spread normal ho jaye, exit karo. Yeh strategy market-neutral hoti hai—matlab overall market up jaye ya down, humein farak nahi padta, hum sirf relative difference se profit lete hain. Lekin dhyan rahe: agar company fundamentally bigad gayi (management change, product failure), to mean permanently shift ho sakta hai aur model fail ho jayega. Isliye quant trading mein risk management aur regime detection bahut zaroori hai.