My backtest was lying to me and i didn't notice for 3 weeks
u/Ashwinnie13 ·
Reddit — r/algotrading
· July 17, 2026 at 11:24
· ⬆ 15 pts
· 💬 11 comments
| View on Reddit ↗
AI Summary
Summary
Author describes discovering a position sizing bug in a mean reversion backtest for SPY options, which caused backtest results to be overly optimistic compared to paper trading.
The bug was in contract sizing based on post-fill margin instead of pre-fill, leading to unrealistic fills.
Post is a cautionary tale about backtesting assumptions and debugging methods, not a research-driven investment thesis.
Quality assessment: Anecdotal / noise — no new data or tradeable insight provided.
Score15
Comments11
Upvote %100%
▶ Full Post Text
built a little mean reversion bot for SPY options. nothing fancy. Backtest looked decent, sharpe around 1.4, max drawdown within what i told myself was "acceptable"
Ran it paper for a week, slightly worse but still profitable. got excited obviously
Here's where I got stupid. I had a position sizing bug in my backtest. basically the script was calculating contracts based on post-fill margin not pre-fill. So in simulation I was getting fills that would never happen live. The paper account caught it but only because I was manually comparing fills to what the model expected
Took me 3 weeks to figure out why live-ish results drifted from backtest
anyway the thing that actually helped was running the logic through a manual replay first. Just a trading game sim where i'd punch entries manually based on signals. Slowed everything down enough that the sizing error became obvious. Sometimes the dumbest debug method is the one that works
Now Im paranoid about every assumption in my backtester. which is probably healthy
what's the dumbest backtest bug you've shipped to production? I need to feel less alone in this