Curious about something — when you backtest a strategy, do you test it only in the market condition it’s designed for? Like a bullish momentum strategy tested only in bull runs?
Or do you stress test it across regimes — what happens to that same strategy in 2015–2016 sideways grind, or March 2020 crash, or 2022 bear market?
My view is survival matters more than performance. A strategy that returns 40% in a bull market but blows up 60% in a sideways market is not a strategy — it’s just beta exposure. But curious what others here are actually doing.
The formatting of your quesiton gives me strong chatgpt vibes, but I will still answer it. I only do Options and for NIFTY/BANKNIFTY I backtest everything for 2020-now, because that is the only part for which good 1-minute data is available.
For other indices and stocks, that window is even smaller. It doesn’t make sense to filter out any days because the number of days is already so small. Only filtering I sometimes do is by DTE/weekday.
I mostly do intraday trades. In my experience, regime filters work wellonly if your average trade duration is more than a week,
2 Likes
Thanks for feedback, do u have full option chain data (1min TF) or only index for backtest?
i am currently working on stocks, etf (intraday and swing ) as a start, portfolio management etc not entered fno directly the problem i am facing is, some strategy gives good result for a year 40-50% but fails in past years or crash, so i am bit confused that should i work on crash or opposite regime more or deploy it directly ?
BTW which framework are u using for BT?
Full option chain data. I had to create it myself. I bought the 1-minute OHLC data for all fno contracts and used it to generate 1-minute option chain snapshots which I now use in my backtesting.
If you are doing stocks, I think you should be able to get 1-minute OHLC data for stocks for 2016 onward from most brokers’ historical apis. BTW 1-minute data is only necessary for backtesting short intraday trades. If you hold your positions for a few days, then 5m or 15m or higher may be enough. If you hold positions for weeks, even EOD data from NSE archives may work.
I am building my own backtesting framework in C++, with bindings in Python and JavaScript (through WASM). The code is not open source yet but you can try it at chartiny.com/backtest.
1 Like
Please let me know from where did you purchase this data and what was the cost ? Incredibly difficult to get a meaningful answer .
That was 2 years ago. From then on, I have been collecting my own data so I don’t have to buy again.
You can buy data from an authorized vendor but it is not really affordable for an individual. Or you can buy it from a fellow retail trader. That would cost you about 5k-15k depending on what indices/stocks you want. If you choose to go that route, get 1-month sample data for free before paying and confirm its validity. Lots of scammers online selling fake data.
Thanks for responding . I have built my own scripts now and got access to Zerodha api . But historic option data is missing , which was the vendor you had used ?
I bought mostly from GDFL and some from truedata. These are authorized vendors for NSE. They charge high prices because they have to pay NSE for every new buyer. Only worth buying if you are a firm.
ICICI Breeze api used to provide some fno data for free then, but it was somewhat inconsistent. More recently I have heard dhan/groww have started providing expired fno data but I have not checked it myself.
I like zerodha and its leadership but they have been some of the worst for algo traders. Until a year ago, they used to charge 2000/month for trading api for you to have the priviledge of paying 20/order. 2000 more for “historical data” which didn’t include FNO and everything it provided (stocks/indices) could be found for free on the internet. It is only competition from another broker that they had to reduce their api prices to 1/4x. Zerodha was the hotshot new guy ten years ago, with its apps and apis, now it feels a bit like an old man struggling to keep up with the changing winds.
1 Like
Thanks again . Zerodha and its API charges were such an infuriating item for so long . Also it was bizzare to see people fawning over them and schooling other for asking pertinent questions. Most of them were investors , who are subsidised from the revenue earned from active traders .
1 Like