Back to Docs
T
Traderoid

HalfLifeMeanReversion Node

Measures speed of price reversion to mean

StatisticalMean ReversionTiming

Overview

Half-life mean reversion quantifies how quickly prices revert to their mean after a deviation. A short half-life (fast reversion) means prices return to equilibrium quickly - ideal for mean reversion strategies. A long half-life (slow reversion) suggests prices will stay deviated for extended periods - avoid mean reversion trades.

This metric is crucial for timing mean reversion trades and position sizing. If half-life is only 2 bars, you need very precise entry timing. If half-life is 20 bars, you have flexibility in entries. Combining half-life with spread magnitude determines the risk/reward of pairs trades.

Formula & Calculation

Half-Life Calculation
Half-Life = ln(2) / |Slope| (from AR(1) regression)
Measures periods until price moves halfway back to mean
Example
Half-Life = 5 bars: After deviating from mean, price reverts to 50% of deviation in 5 bars
Half-Life = 20 bars: Same reversion takes 20 bars (slower, harder to trade)

Parameters

ParameterDefaultDescription
lookback20-100Period for regression calculation
mean_typeSMAMethod for calculating mean (SMA or EMA)

Common Use Cases

1. Mean Reversion Setup Validation

Only take mean reversion trades when half-life < 10. Longer half-lives indicate weak or broken mean reversion.

2. Position Sizing

Shorter half-life = more aggressive sizing. Longer half-life = reduce size dramatically. Manage position size inversely to half-life.

3. Exit Timing

Target exit at 1-1.5x half-life bars. If half-life is 5, expect mean reversion around 7-8 bars. Exit sooner if target reached.

4. Pairs Trading Verification

Calculate half-life of spread between two cointegrated stocks. Confirms whether mean reversion will work in timeframe.

Advantages & Limitations

Advantages

  • Quantifies reversion speed
  • Enables dynamic positioning
  • Risk-aligned exit timing
  • Directly actionable for trading
!

Limitations

  • Assumes mean reversion exists
  • Can be unstable over time
  • Lookback period dependent
  • Breaks in trending markets

Related Nodes