
Built a backtesting engine for NSE stocks with historical index constituents — flexible entry/exit rules, corporate-action-adjusted data
I wanted to test certain strategies and everything out there was either too complex to actually use or too expensive, so I ended up building this myself.
What it can do:
- Trade an index (with the actual historical constituents for each date — not today's list applied retroactively, which is the mistake most DIY backtests make) or a custom list of stocks.
- Build entry rules from technical indicators (RSI, SMA/EMA crossovers, volume spikes), combined in flexible OR-of-AND groups.
- Choose from multiple exit strategies — a target %, a stop-loss %, a max holding period, or any combination of these, with whichever hits first deciding the exit.
- Compare multiple strategy variants side-by-side on the same data.
On data quality: OHLCV data goes back to 2005 from official NSE bhavcopies, adjusted for splits/bonuses/reverse-splits, and cross-verified for demergers/spin-offs on the clearest cases — so a corporate action doesn't show up as a fake crash in your results.
To be clear about what this is: it's a swing-trading strategy backtester — works off daily OHLCV data, so it's built for multi-day holding strategies, not intraday/scalping.
Still very much a work in progress. If you've got suggestions for what to improve, I'd genuinely value the input — and I'll give access to anyone who offers something useful.