Z-Score Mean Reversion Backtest in Crypto: Fees, Slippage and Break-Even Costs
A z-score rule buys when price is far below its rolling mean in standard-deviation units. The rolling window and the threshold decide how many trades — and how many falling knives.
Short answer
A z-score mean-reversion rule computes z = (close − rolling mean) ÷ rolling standard deviation and buys below a threshold (e.g. −2), exiting near zero. Because both mean and deviation are rolling, a strong trend shifts them, and z can stay extreme while price keeps falling. Use closed bars, test window and threshold as a grid, compute break-even cost, and add a stop or trend filter. Report results separately for trending and ranging periods.
Break-even cost
| Item | Value (illustrative) |
|---|---|
| Trades | 210 |
| Gross avg per trade | +0.24% |
| Fees (2 × 0.05%) | −0.10% |
| Slippage (2 × 0.03%) | −0.06% |
| Net avg per trade | +0.08% |
| Break-even round-trip cost | 0.24% |
Window and threshold
| Window / threshold | Trades | Net avg (illustrative) |
|---|---|---|
| 20 / −2.0 | 210 | +0.11% |
| 50 / −2.0 | 120 | +0.16% |
| 20 / −2.5 | 80 | +0.19% (small sample) |
Conclusion
Related: CCI Mean Reversion Backtest in Crypto: Fees, Slippage and Break-Even Costs, Standard Deviation in Crypto: Why the Value Changes Before Candle Close.
Backtest the z-score mean reversion rule with costs in ChartsPod.
Open the ChartsPod terminalReport results separately for trending and ranging periods.
Test Z-Score Mean Reversion Backtest in Crypto on a perpetual chart; no account is needed to chart.
Launch ChartsPodQuestions readers ask
What is a z-score?
Distance from the rolling mean in standard deviations.
Why can z stay extreme?
Trends drag mean and deviation.
What should I add?
A stop or trend filter.
Sources and methodology
Backtest cost logic follows TradingView's Pine Script strategy documentation; indicator definitions are standard. All performance numbers are illustrative examples of the method, not results of real tests.
- TradingView Pine Script: Strategies — simulated fills and assumptions.
- TradingView Pine Script: Repainting — live vs historical calculation.
- ChartsPod documentation — guides for order flow, derivatives, alerts, backtests, journal and workspaces.
This article explains research tools and workflows. It is not financial advice, does not recommend buying or selling any asset and does not predict prices. Crypto derivatives carry a risk of rapid and total loss of margin.
CHARTSPOD EDITORIAL EDITION · RESEARCH AND EDUCATION ONLY · NOT FINANCIAL ADVICE.