“Reversion to the mean is the iron rule of the financial markets.”
- John Bogle
Mean reversion is one of the most well-known quantitative trading strategies, built on the idea that asset prices tend to revert back to their historical average overtime. Unlike trend-following strategies that seek to ride momentum, mean reversion traders look for assets that have deviated significantly from their average price – expecting them to snap back to the mean.
This strategy is widely used in equities, forex and options markets, often relying on indicators such as moving averages, Bollinger Bands, Z-score deviations and RSI. For example, if a stock price falls far below its 50-day moving average, a mean reversion strategist might buy it, anticipating a rebound. Conversely, if the price soars well above its historical mean, they might sell or short the asset.
While mean reversion can be profitable, it comes with risks – markets don’t always revert, and extreme deviations can signal a structural shift rather than a temporary mispricing. Proper risk management, stop-loss strategies and parameter optimisation are essential to make mean reversion strategies robust in real-world trading.
Idea: What goes up will eventually go down (as well the opposite).
Example: If a stock falls too far too fast, a quant strategy might buy it, betting on a rebound.
Why this works: Investors tend to overreact to news, creating short term inefficiencies in the market (mispricing).
Risk: Some stocks drop for a reason – mean reversion strategies can lead to catching falling knives (catching an asset falling in price only to find it continues falling).
Real world application: Many statistical arbitrage hedge funds use mean reversion models (Jim Simons in his Medallion Fund also used this strategy!).
Python Example: Mean Reversal Signal
import yfinance as yf
import pandas as pd
ticker = "AAPL"
data = yf.download(ticker, start="2023-01-01", end="2024-01-01")
lookback = 20
threshold = 0.02
data['SMA'] = data['Close'].rolling(lookback).mean()
data['Position'] = 0
data.loc[data['Close'] < data['SMA'] * (1 - threshold), 'Position'] = 1
data.loc[data['Close'] > data['SMA'] * (1 + threshold), 'Position'] = -1
print(data[['Close', 'SMA', 'Position']].dropna().tail())
Code Breakdown
Essentially, what this code is doing is fetching a years worth of historical price data for Apple from Yahoo Finance. It then computes a 20-day moving average and generates buy/sell signals when price deviates ±2% from the SMA.
Results Analysis
The output of this script contains three key pieces of information for each trading day:
1) Close Price: Closing price of the stock that day.
2) Simple Moving Average (SMA): In this example it is the 20-day moving average of the closing price.
3) Trading Signal (Position): 1 Buy, -1 Sell and 0 Hold. Based on how far the stock price deviates from the SMA.
When Would or Wouldn’t Mean Reversion Work?
When it works
Mean reversion works effectively in stable markets where prices fluctuate around a fair value due to efficient pricing. Examples include Blue-Chip stocks, Forex and bonds and low volatility assets.
When it doesn’t work
Mean reversion tends to struggle in trending markets where there exists strong momentum or fundamental shifts prevent prices from reverting to historical averages. This includes trending markets, high volatility stocks, crypto and commodities as well as breakout stocks.
This Weeks Quant News Story
BlackRock Tests ‘Quantum Cognition” AI for high-yield bond picks
BlackRock is shaking up the fixed income world with its “quantum cognition” AI, a cutting-edge model designed to rethink high-yield bond trading. Instead of relying on traditional quant methods, this AI mimics human decision-making to navigate liquidity challenges, identifying smarter bond substitutes when markets get tricky. The result? Lower trading costs, smoother execution, and a more adaptable machine learning strategy. By merging machine learning which cognitive intelligence, BlackRock is paving the way for a new era in AI-driven investing, proving that even in the more traditional bond market, innovation never stops. Read more about this here.
Key Terms
Rolling Mean: Also known as moving average, is the continuously updated average of the last N values in a dataset, recalculated as new data points arrive.
SMA (Simple Moving Average): A commonly used indicator in trading and investing. It evens out price fluctuations by calculating the average closing price over a specific period.
Bollinger Bands: A volatility indicator using a moving average with upper and lower bands set at ±2 standard deviations to identify overbought or oversold conditions.
Z-Score Deviations: Measures how many standard deviations a value is from the mean, helping detect anomalies or mean reversion signals.
RSI (Relative Strength Index): A momentum oscillator from 0 to 100 that measures the speed and magnitude of price movements to also identify overbought (RSI>70) or oversold (RSI<30) conditions.
Quantum Cognition: Applies quantum mechanics principles to model human decision making, which captures uncertainty (which many algorithms struggle with), contextual dependence and non-linear thought processes (which are thought processes that don’t follow a fixed, step-by-step path, allowing for contextual, flexible and unpredictable reasoning).
Blue-Chip Stocks: Stocks with consistent earnings and low volatility (e.g. shares of utility companies).
Breakout Stocks: stocks reacting to earnings surprises, major news announcements or industry shifts may never return to the mean.