Skip to main content
Connecting to market data...

My Python Mean Reversion Bot — 2 Years of Live Results

r/algotradingstocksDaily (automated)by reddit_community

Z-score mean reversion on 50 large-cap stocks. Long at Z<-2, short at Z>2, exit at ±0.5. 2 years live: 18% annual, 12% max DD, 1.4 Sharpe. Key: diversification.

ENTRY RULES

Calculate Z-score = (price - 20d SMA) / 20d StdDev | Enter long when Z-score < -2.0 | Enter short when Z-score > 2.0 | Only trade top 50 S&P stocks | Max 5 concurrent positions per direction

EXIT RULES

Exit long when Z-score > -0.5 | Exit short when Z-score < 0.5 | Hard stop at Z = -3.5 (long) or 3.5 (short) | Maximum hold time: 10 trading days | Close all if SPY drops 3% in a day

INDICATORS

Z-ScoreSMAStandard Deviation

ORIGINAL POST

456
r/algotradingposted by reddit_community

My Python Mean Reversion Bot — 2 Years of Live Results

Sharing my mean reversion algorithm that has been live for 2 years. The strategy: calculate Z-score of price relative to 20-day mean. Enter long when Z < -2.0, short when Z > 2.0. Exit when Z returns to ±0.5. Applied to a basket of 50 large-cap stocks. Annual return ~18% with max drawdown 12%. Sharpe ratio 1.4. The key is portfolio diversification — any single stock can blow up but the basket stays stable.

312 commentsView on Reddit

BACKTEST THIS STRATEGY

Sign up free to customize & re-run backtests

Sign Up Free

Open in Strategy Builder

Import this strategy into the visual builder to customize, backtest, and paper trade

Customize in Builder

Add to My Strategies

Save this strategy to your dashboard for quick access

Sign In to Save

Want more strategies? Browse our full collection.

Browse All Strategies
My Python Mean Reversion Bot — 2 Years of Live Results | iGotFomo Strategies