Mean Reversion
Z-score framework, Bollinger Band reversion, pairs trading, funding rate arbitrage, and regime detection for trading agents.
Mean Reversion is a skill for CLI Trader that equips your agent with a systematic framework for identifying and trading mean-reverting price behavior across stocks and crypto markets. The core premise is straightforward — prices that deviate significantly from their historical average tend to revert — but the execution requires statistical rigor to avoid the common trap of catching falling knives in trending markets. This skill provides the statistical toolkit and decision logic to trade mean reversion with discipline.
The skill covers multiple complementary approaches to mean reversion trading. The z-score framework standardizes price deviations for any asset, providing clear entry and exit signals with configurable thresholds. Bollinger Band percent-B reversion identifies overbought and oversold conditions using volatility-adjusted bands. Pairs trading via cointegration tests (Augmented Dickey-Fuller and Johansen) finds asset pairs with stable long-run relationships whose spread reliably reverts to its mean. Funding rate fading in crypto perpetual markets identifies sentiment extremes where elevated funding rates create a statistical edge for contrarian positions. Critically, the skill includes regime detection to determine whether current market conditions favor mean reversion or trend following, using the Hurst exponent to classify market behavior and half-life calculations to estimate how quickly deviations correct.
In a CLI trading workflow, this skill provides the analytical engine for a mean reversion strategy. Feed it price data through a market data MCP or API integration, and the agent applies the appropriate statistical tests, calculates z-scores and half-lives, checks regime conditions, and outputs trade signals with defined risk parameters. It pairs naturally with a backtesting pipeline to validate parameter choices on historical data before deploying capital, and with an execution layer to route orders when signals trigger.
For the complete methodology — including formulas, decision trees, worked examples, and validation checklists — see the full Mean Reversion skill guide.