Half-Life -- Half-Life of Mean Reversion
Contents
Overview
The Half-Life of Mean Reversion estimates how many candles it takes for price to revert halfway back to its mean, using OLS regression on an Ornstein-Uhlenbeck process. It answers the question: if price deviates from the mean, how fast does it snap back?
The calculation fits a linear regression to the price series' first differences against its lagged levels (the discrete Ornstein-Uhlenbeck model). The regression coefficient gives the speed of mean reversion, and the half-life is derived as -log(2) / coefficient. A short half-life means price deviations are corrected quickly -- the market snaps back to its mean within a few candles. A long half-life means reversion is sluggish or essentially non-existent.
The key insight: if Hurst Exponent tells you whether the market is mean-reverting, Half-Life tells you how fast that reversion happens. Knowing a market is mean-reverting is only half the picture -- you also need to know the timescale. If the half-life is 15 candles, you can expect a dip to recover halfway within 15 candles and calibrate your exits accordingly. If the half-life is 500 candles, reversion is so slow that it is practically useless for trading -- the statistical property exists but the time horizon is impractical.
Format
halflife_{period}
The period defines the lookback window -- how many candles of price data are used to estimate the mean-reversion speed via OLS regression.
| Example | Period | Use Case |
|---|---|---|
halflife_100 | 100 | Moderate lookback -- captures recent regime, reacts faster to changes |
halflife_200 | 200 | Standard -- stable estimate, good balance of accuracy and responsiveness |
halflife_500 | 500 | Very stable -- captures the dominant long-term mean-reversion speed |
Period range: 50 to 500.
Value range: 1 to very large (in candles). Practical useful range: 5 to 100 candles.
Understanding Half-Life Values
Half-Life values are expressed in candles (the number of bars on your chart). The interpretation depends on your timeframe:
| Half-Life (candles) | Speed | Interpretation |
|---|---|---|
| 1 -- 20 | Very fast | Day-trading territory. Price reverts halfway to the mean within 20 candles. On a 1h chart, that is less than a day. Excellent for short-term mean-reversion trades with tight time exits. |
| 20 -- 50 | Moderate | Swing-trading territory. On a 1h chart, reversion takes 1--2 days. Good for multi-day positions with RSI or Z-Score entries. Set time_in_position to roughly 2x the half-life. |
| 50 -- 100 | Slow | Position-trading territory. On a 1h chart, reversion takes 2--4 days. Only worthwhile if the deviation is large enough to justify holding that long. |
| 100+ | Impractically slow | Reversion exists statistically but takes too long to be tradeable. A half-life of 500 on the hourly chart means roughly 3 weeks to revert halfway. Other market dynamics will dominate before reversion completes. |
Half-Life values depend heavily on the timeframe. A half-life of 20 on the 1h chart means ~20 hours. A half-life of 20 on the 1d chart means ~20 days. Always interpret half-life in the context of your chart's timeframe.
Understanding Operators with Half-Life
Each operator behaves differently with Half-Life. Because Half-Life is a regime qualifier (it tells you how fast mean reversion works), it is almost always used in combination with a regime detector (Hurst) and a directional entry trigger (RSI, Z-Score).
< (Less Than) -- State-Based
What it does: The trigger is true on every candle where the Half-Life is below the threshold.
On the chart: Mean reversion is happening fast. Price deviations are being corrected quickly. This trigger stays active for as long as the half-life remains short.
[[actions.triggers]]
indicator = "halflife_200"
operator = "<"
target = "30"
timeframe = "1h"
Typical use: "Only trade mean-reversion strategies when reversion is fast enough to be profitable." A half-life below 30 candles means price should recover halfway within about 30 hours on the hourly chart -- fast enough for swing trades. This filters out markets where reversion is too slow to be practical.
> (Greater Than) -- State-Based
What it does: The trigger is true on every candle where the Half-Life is above the threshold.
On the chart: Mean reversion is slow or absent. Price deviations persist for long periods before correcting.
[[actions.triggers]]
indicator = "halflife_200"
operator = ">"
target = "100"
timeframe = "1h"
Typical use: Defensive filter -- "do not enter mean-reversion trades when the half-life is too long." If reversion takes 100+ candles, the trade will tie up capital for too long. Some strategies use halflife > 100 as a condition to exit or avoid mean-reversion positions entirely.
cross_below -- Event-Based
What it does: Fires once, at the exact candle where the Half-Life transitions from above the threshold to below it. The previous candle had Half-Life >= the target, and the current candle has Half-Life < the target.
[[actions.triggers]]
indicator = "halflife_200"
operator = "cross_below"
target = "30"
timeframe = "1h"
Typical use: Detect the moment the market transitions into a fast-reverting regime. When the half-life drops below 30, mean reversion just became tradeable. This can trigger the activation of mean-reversion entries.
cross_above -- Event-Based
What it does: Fires once, at the exact candle where the Half-Life transitions from below the threshold to above it. The previous candle had Half-Life <= the target, and the current candle has Half-Life > the target.
[[actions.triggers]]
indicator = "halflife_200"
operator = "cross_above"
target = "50"
timeframe = "1h"
Typical use: Detect the moment mean reversion slows down. When the half-life crosses above 50, the market is no longer reverting fast enough for swing trades. This can be used to disable mean-reversion entries or exit existing positions.
= (Equal) -- Not Recommended for Half-Life
Why: Half-Life produces floating-point values calculated to many decimal places. Exact equality (e.g., halflife_200 = 20) will almost never be true. Use < or > instead.
- Use
<to ensure mean reversion is fast enough to trade. This is the most common Half-Life operator. - Use
>to avoid or exit positions when reversion is too slow. - Use
cross_below/cross_aboveto detect the exact moment the reversion speed changes regime.
TOML Examples
Short Half-Life + RSI Dip Buy
Only buy RSI oversold dips when the half-life confirms fast mean reversion. A half-life below 25 candles on the hourly chart means price should recover halfway within about a day -- ideal for swing dip-buying.
[[actions]]
type = "open_long"
amount = "100 USDC"
[[actions.triggers]]
indicator = "halflife_200"
operator = "<"
target = "25"
timeframe = "1h"
[[actions.triggers]]
indicator = "rsi_14"
operator = "<"
target = "30"
timeframe = "1h"
max_count = 1
Half-Life-Based Time Exit
Use the half-life to calibrate your exit timing. If the half-life is 20 candles, the market should revert halfway in 20 bars and fully in roughly 40--60 bars. Set time_in_position to 2x the estimated half-life (here ~40 candles) as a time-based stop.
# Entry: dip buy with half-life confirmation
[[actions]]
type = "open_long"
amount = "100 USDC"
[[actions.triggers]]
indicator = "halflife_200"
operator = "<"
target = "20"
timeframe = "1h"
[[actions.triggers]]
indicator = "rsi_14"
operator = "<"
target = "30"
timeframe = "1h"
max_count = 1
# Exit: time-based stop calibrated to ~2x half-life
[[actions]]
type = "sell"
amount = "100%"
[[actions.triggers]]
type = "time_in_position"
candles = 40
timeframe = "1h"
Complete Regime Setup: Hurst + Half-Life + Entry
The full mean-reversion stack: Hurst confirms the market IS mean-reverting, Half-Life confirms reversion is fast enough, and RSI provides the actual entry signal.
[[actions]]
type = "open_long"
amount = "100 USDC"
[[actions.triggers]]
indicator = "hurst_200"
operator = "<"
target = "0.45"
timeframe = "1h"
[[actions.triggers]]
indicator = "halflife_200"
operator = "<"
target = "30"
timeframe = "1h"
[[actions.triggers]]
indicator = "rsi_14"
operator = "<"
target = "30"
timeframe = "1h"
max_count = 1
Tips
Hurst Exponent and Half-Life are complementary. Hurst tells you whether the market is mean-reverting (H < 0.5). Half-Life tells you how fast that reversion happens. A market with H = 0.35 and a half-life of 15 candles is a mean-reversion paradise. A market with H = 0.40 and a half-life of 300 candles is mean-reverting in theory but untradeable in practice. Always use both together.
If the estimated half-life is N candles, price should revert halfway in N candles and approximately fully in 2--3x N candles. Set your time_in_position exit to roughly 2x the half-life as a safety stop. If the trade has not recovered by then, the regime may have changed and you should exit.
Like Hurst, the Half-Life estimate is noisy on short lookback windows. The OLS regression needs enough data points to produce a reliable slope estimate. Use 200+ candles for the period. Shorter periods may produce wildly fluctuating half-life values that are not actionable.
When the half-life exceeds 100 candles on your timeframe, mean reversion is too slow to be profitable. On the hourly chart, 100 candles is over 4 days -- other market dynamics (news, macro events, sentiment shifts) will dominate before the statistical reversion completes. If the half-life is high, either switch to momentum strategies or stay flat.