Algo Traders, how much backtesting is enough?

I currently backtest my option buying strategies on data since January 2023.

Is that enough? Or should I go further back? I do have NIFTY/BANKNIFTY 1-minute options OHLCV data since 2019. But it is generally difficult to come up with strategies that work on such a long period.

Unless you can keep adapting to changing markets with new systems, such a short window is not very useful. Even if system happens to work overall, you will not know historical risk that the system had to face and might become too optimistic. Perhaps a group of such systems based on current regime might work, but i don’t trade that way so cant say for sure - and you will still need to test over large sample.

A counter to this can be that markets may have changed permanently and this short window edge will become future long term edge. But i would find it hard to put good money for something like this and at least will need clear cut rules to stop system and some reason to believe that markets have changed for good.

While I don’t trade options, for my own trading i prefer 10+ years of data over which system should work. A working system will still have ups and downs as markets become favorable and not, but overall it will work with a decent upward equity curve.

Now one way to work with options is to have an edge in underlying and then execute via options. With that you can test the underlying edge over large sample and execution stuff over whatever options data is available. That looks good enough to me.

Thanks for such a detailed reply!

I think I can extend my backtesting period to 2021. Can’t go before that because 2020 was weird and pre-2020, there wasn’t a lot of volume.

Ignoring data is a major mistake, nothing weird about 2020. We cant assume that markets will always be like post 2020, when they change you might suffer.

I wouldn’t trade a system with only few years of data, but anyway - at least assume future DD would be much worse and multiple times what you see in data. Hard to say how much worse, but better be conservative.

1 Like

HI is it possible for you to share the options 1min data for nifty, banknifty and sensex from 2021

in my opinion, 10yrs is enough bcos in 1-2 yrs will miss many imp things. wnt get to knw drawdwn. if in this year n in prev. yr dd ws arnd 10k in any strategy n before ws arnd 15k or 18k so u hv to move acc to 15k not 10k n will hv to trade till double dd so hv to trade till 30k. n in some yrs, stratgy doesnt perform for 1 yr or even 2yrs n thn strts performin again so u ll leave d strategy. in 10yrs u ll get larger pic n consistency of system. use algotest to test bcos nt possible to do it manually
kindly compare if algotest data is correct with ur data n update here

1 Like

One or two years is very less, you will blow up in case the drawdown goes up and you haven’t done enough position sizing for that. I would suggest use tradingview deep backtesting as well. For example, below are the backtested results for my strategy that I trade in Nifty options (actual screenshot using tradingview backtesting tool) :

Once you get results like these, it will give you the confidence to trade. Also, tradingview pine language is comparatively easy to learn and code.

Thanks for sharing the screenshot. I did not know TV has option backtesting features.

Btw, what exactly is this backtest for? If I remember correctly, NIFTY options were introduced in 2019. And even then the volume was not there for the first few months. How are you even testing an option strat for 2009-2024? How can the results be so “complete” when there isn’t any data for a big part of that period?

My guess is that it is just using the index price to “simulate” option prices, in which case, it is not very useful.

No, the strategy and the backtest is on Nifty as the underlying. So the strategy gives the signals on nifty charts, and then I trade in options. Suppose, I get a long signal, I will either buy call,future or sell a put and vice versa.

How do you know what the Option Premium was when there wasn’t any Option Contract to begin with?

In my opinion, no amount of backtesting is enough. Back testing uses 1 min snapshot and the spikes are not counted resulting is mismatch and misleading outcome. The more numbers of legs and re entry etc involved, more incorrect will be the backtesting results.
The following points to be remembered:-

  1. Backtesting should be used to short list a few strategies.
  2. Forward testing with 1 lot is the only way.
  3. Increase lot size after every drawdown.
  4. Keep evolving with changing market!
2 Likes

Yeah, the online platforms do use 1 minute snapshots of the option chain for backtesting, which can be very misleading. This was one of the reasons why I decided to write my own backtests. I use the OHLC data for each option and assume the worst whenever there is ambiguity, i.e., if a big candle hits both my SL and Target, I assume the SL was hit, etc. This gives significantly more accurate results, especially for expiry day trading.

1 Like

hey, wht do you mean by this? if backtesting using 1 min ohlc data thn spikes will also be counted

Three things here, most algo backtests will assume SL was executed at the end of the minute, not in between. Even if some method as @iankurseth mentioned might count the Low/high that had happened in between of the minute (considering OHLC), the trigger time will be considered end of the minute, thus reentry price will be affected drastically.

Secondly, even if some smart algo logic goes to check every second, then also sharp spikes (Freak Candles) are often not captured correctly in OHLC, since data is not tick by tick.

Thirdly, ask bid plays a role in execution, specially if far ITM strikes, next weekly or monthly expiries. So, LTP method can never be accurate! And who will consider slippages? There are positive slippages and negative slippages too.

In plain language, backtesting can never be accurate, but might work as a guiding tool for general outcome.

Have been on algo for about a year everyday ! Seen all of these. But some algo developer might be wiser to comment upon!

Once you have enough sample of live trades, you can get a general estimate for slippages.
I use a multiplier on expenses for a trade to include slippage too. So if slippage = other expenses, just double the expense etc.

WIthout this, backtest will be too optimistic. And yes, we need to assume that stop hits before target etc. There will be still some differences due to data, but overall its fine. Edge should be very good in backtest so that we can get a good edge in live markets even after some degradation.

2 Likes