Built a backtesting engine for NSE stocks with historical index constituents — flexible entry/exit rules, corporate-action-adjusted data

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/s2ddw56krebh1.png?width=1807&format=png&auto=webp&s=14058d489bb1157821703c7c7544b524210a0382

https://preview.redd.it/8eidd76krebh1.png?width=1781&format=png&auto=webp&s=6893f534a15d2a4fc40ef6d33155748a5c02a43b

https://preview.redd.it/j2qdk76krebh1.png?width=1287&format=png&auto=webp&s=371ebcbad3538aa0a46c24751cb1655ca5657620

reddit.com
u/Vivid_Opportunity849 — 14 hours ago

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/2nn864x0rebh1.png?width=1807&format=png&auto=webp&s=d01a34159e13d47c2b7b4ba16fad707e8d8c7865

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

https://preview.redd.it/qtbe44x0rebh1.png?width=1287&format=png&auto=webp&s=4ef0398191513a08c55759625f099e9f30812328

reddit.com
u/Vivid_Opportunity849 — 15 hours ago

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/guulqhjopebh1.png?width=1807&format=png&auto=webp&s=7bf33661e48f36c856a31d895773bf5db7a4dfe8

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

https://preview.redd.it/4fqurjjopebh1.png?width=1287&format=png&auto=webp&s=f1b7dd971b6a72f21b048fc27414618a4a6e8b89

reddit.com
u/Vivid_Opportunity849 — 15 hours ago

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

reddit.com
u/Vivid_Opportunity849 — 15 hours ago