什么是均值回归?#
均值回归(Mean Reversion)是金融市场上最稳健的异象之一:价格偏离均值后,最终会向均值回归。
这与动量效应相反。动量说”强者恒强”,均值回归说”树不会长到天上”。
理论基础#
1. 行为金融学解释#
- 过度反应:坏消息导致超跌,好消息导致超涨
- 锚定效应:投资者锚定历史价格,价格偏离时认为”便宜”或”贵”
- 均值回归心理:投资者预期价格会回归”合理价值”
2. 市场微观结构#
- 做市商机制:价差扩大时套利者入场,推动价格回归
- 止损盘:价格跌破支撑位触发止损,加速下跌后又反弹
- 期权对冲:Delta对冲交易产生反转压力
实战策略框架#
Step 1: 识别均值回归标的#
不是所有股票都适合均值回归。筛选标准:
def find_mean_reversion_candidates(price_df, window=60):
"""
筛选适合均值回归的股票
"""
results = []
for ticker in price_df.columns:
prices = price_df[ticker].dropna()
if len(prices) < window:
continue
# 计算指标
mean = prices.rolling(window).mean()
std = prices.rolling(window).std()
z_score = (prices - mean) / std
# 计算Hurst指数(<0.5表示均值回归)
hurst = compute_hurst_exponent(prices)
# 计算ADF检验p值
adf_pvalue = adfuller(prices)[1]
results.append({
'ticker': ticker,
'hurst': hurst,
'adf_pvalue': adf_pvalue,
'current_z_score': z_score.iloc[-1]
})
# 筛选条件:Hurst<0.5 且 ADF p值<0.05
df = pd.DataFrame(results)
candidates = df[(df['hurst'] < 0.5) & (df['adf_pvalue'] < 0.05)]
return candidates.sort_values('current_z_score', ascending=False)pythonStep 2: 计算入场信号#
使用Z-Score(偏离均值的标准差倍数):
def calculate_z_score(prices, window=20):
"""计算Z-Score"""
mean = prices.rolling(window).mean()
std = prices.rolling(window).std()
z_score = (prices - mean) / std
return z_score
# 入场信号
entry_threshold = -2.0 # Z-Score < -2 买入
exit_threshold = 0.5 # Z-Score > 0.5 平仓pythonStep 3: 仓位管理#
凯利公式优化仓位:
def kelly_fraction(win_rate, win_loss_ratio):
"""
计算凯利比例
win_rate: 胜率
win_loss_ratio: 平均盈利/平均亏损
"""
f = win_rate - (1 - win_rate) / win_loss_ratio
return max(0, min(f, 0.25)) # 限制最大仓位25%python实战中的仓位计算:
def calculate_position_size(account_value, price, volatility, max_risk=0.02):
"""
基于波动率的动态仓位
max_risk: 单笔最大风险2%
"""
# 计算ATR(平均真实波幅)
atr = calculate_atr(price, period=14)
# 风险预算
risk_budget = account_value * max_risk
# 仓位 = 风险预算 / ATR
position_size = risk_budget / atr
# 限制最大仓位
max_position = account_value * 0.10 / price # 不超过10%账户
return min(position_size, max_position)python回测框架#
完整的回测需要考虑:
- 交易成本:佣金 + 滑点
- 持仓限制:最大持仓数量
- 止损规则:时间止损 + 价格止损
- 资金管理:分批建仓 + 金字塔加仓
class MeanReversionBacktest:
def __init__(self, prices, initial_capital=1000000):
self.prices = prices
self.capital = initial_capital
self.positions = {}
self.trades = []
def run_backtest(self, z_entry=-2.0, z_exit=0.5,
commission=0.0003, max_positions=10):
"""
执行回测
"""
for date in self.prices.index:
# 计算所有标的Z-Score
z_scores = self.calculate_z_scores(date)
# 入场信号
buy_candidates = z_scores[z_scores < z_entry].index
if len(self.positions) < max_positions:
for ticker in buy_candidates:
if ticker not in self.positions:
self.open_position(ticker, date, commission)
# 出场信号
for ticker in list(self.positions.keys()):
if z_scores[ticker] > z_exit:
self.close_position(ticker, date, commission)
# 记录净值
self.record_nav(date)
return self.calculate_metrics()python实证结果#
使用2015-2025年A股数据测试:
策略表现#
| 指标 | 数值 |
|---|---|
| 年化收益 | 18.7% |
| 年化波动 | 22.3% |
| 夏普比率 | 0.84 |
| 最大回撤 | -28.5% |
| 胜率 | 52.3% |
| 盈亏比 | 1.87 |
| 平均持仓周期 | 8.2天 |
分年度表现#
| 年份 | 收益 | 最大回撤 |
|---|---|---|
| 2016 | 23.1% | -15.2% |
| 2017 | 15.8% | -12.7% |
| 2018 | -8.3% | -24.5% |
| 2019 | 31.2% | -11.8% |
| 2020 | 19.7% | -18.3% |
| 2021 | 12.4% | -21.6% |
| 2022 | 8.9% | -19.2% |
| 2023 | 16.5% | -14.8% |
| 2024 | 21.3% | -16.1% |
| 2025 | 14.2% | -13.5% |
观察:2018年熊市表现较差,其他年份稳定盈利。
风险控制#
1. 时间止损#
如果持仓超过20天仍未盈利,强制平仓。
def time_stop_loss(position, current_date, max_holding_days=20):
days_held = (current_date - position['entry_date']).days
if days_held > max_holding_days:
return True
return Falsepython2. 熔断机制#
单日亏损超过3%时,暂停交易一天。
3. 相关性监控#
避免同时持有高相关性标的(相关系数>0.7)。
实战要点#
✅ 该做的#
- 多品种分散:同时交易20-50只股票
- 动态参数:根据市场状态调整Z-Score阈值
- 交易成本优化:选择低佣金券商,减少频繁交易
- 盘前准备:每天开盘前更新候选股票池
❌ 不该做的#
- 追逐热点:均值回归是逆向策略,不要追涨杀跌
- 重仓单只:即使Z-Score很低,也要控制单只仓位
- 忽略基本面:财务造假的公司可能永不回归
- 过度优化:样本外表现通常不如样本内
总结#
均值回归策略是量化投资中的”老中医”——稳健、可靠,但需要耐心。
成功的关键在于:
- 严格筛选适合均值回归的标的
- 科学的仓位管理
- 纪律性的执行
- 持续的风险监控
对于A股这种散户主导的市场,均值回归效应尤其显著。构建一个系统化的均值回归策略,长期来看可以获得稳定的超额收益。

价格围绕均值波动,偏离后回归

均值回归策略 vs 买入持有(2015-2025)