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.

https://preview.redd.it/vx3fgjoyoebh1.png?width=1807&format=png&auto=webp&s=9b078718b80be2ab21cfbb8a477948b643bc172f

https://preview.redd.it/kf6m0toyoebh1.png?width=1781&format=png&auto=webp&s=b5e52a70f76cc3394373dab74b13d35778fc2798

https://preview.redd.it/5ltvr3wyoebh1.png?width=1287&format=png&auto=webp&s=79600c2fb9fea6f136931e80d6732ec4ccc9786e

Posted Jul 5, 2026, 12:38 PM UTC

19
Loading comments…