BACKTESTING · Z-SCORE MEAN REVERSION

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

ItemValue (illustrative)
Trades210
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 cost0.24%
Z-Score Mean Reversion: edge vs cost per trade (%)Z-Score Mean Reversion: edge vs cost per trade (%): Gross edge 0.24 %; Fees 0.10 %; Fees + slippage 0.16 %.Z-SCORE MEAN REVERSION: EDGE VS COST PER TRADE (%)Gross edge0.24 %Fees0.10 %Fees + slippage0.16 %
Edge per trade versus cost per trade. Original ChartsPod editorial graphic.

Window and threshold

Window / thresholdTradesNet avg (illustrative)
20 / −2.0210+0.11%
50 / −2.0120+0.16%
20 / −2.580+0.19% (small sample)
Illustrative trades by settingIllustrative trades by setting: 20 / −2.0 210 trades; 50 / −2.0 120 trades; 20 / −2.5 80 trades.ILLUSTRATIVE TRADES BY SETTING20 / −2.0210 trades50 / −2.0120 trades20 / −2.580 trades
Stricter settings trade less. Original ChartsPod editorial graphic.

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 terminal

Report 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 ChartsPod

Questions 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.

  1. TradingView Pine Script: Strategies — simulated fills and assumptions.
  2. TradingView Pine Script: Repainting — live vs historical calculation.
  3. 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.