Before we jump into why we must backtest trading strategies, lets first understand what backtesting is!
Investopedia defines it best as: “Backtesting allows a trader to simulate a trading strategy using historical data to generate results and analyse risk and profitability before risking any actual capital.“
For us, the primary reason to backtest is to determine profitability and risk. How good was the strategy’s return historically? And how much did we risk to make that return? A backtest answers these questions quite well.
Backtesting, if used correctly, is a powerful tool to help evaluate trading strategies. However, as with any tool, it has limitations. As a silent observer over the past few months, we’ve witnessed people pile into now crowded strategies after backtesting them (ehm the #920Straddle and its variations). Some people made money. Others didn’t. Some lost a lot with the so called #freaktrades. Our purpose here is to explain the benefits and limitations of backtesting trading strategies in India as we understand them, while also making backtesting accessible to everyone interested.
There are some questions that a backtest doesn’t answer well though. Questions like:
We at AlgoTest use backtests as part of a 3-step strategy deployment cycle.
We see a lot of people using a fixed historical dataset, eg data from 2018-present to develop a strategy iteratively. They then add parameters and tweak them until the strategy backtest gives good results. This historical dataset is called “in-sample” data. Then they deploy this strategy to the live market, and don’t get as good results as the backtest result. One of the reasons behind this discrepancy is data snooping (or data dredging).
A key missing ingredient is Step 2: freeze your strategy parameters after a successful backtest, and follow that up with paper trading. Paper trading entails running your strategy on market data different from the data used for developing it. In this case, run your strategy against live market data. This data against which you’re testing the strategy parameters is called “out-of-sample” data. So you develop your strategy using in-sample data, freeze the strategy parameters, then run it against the out-of-sample data. If the results are comparable, then the odds of data-snooping are lower than before, and your strategy might be the real deal.
From investopedia – “Similarly, traders must avoid data dredging, in which they test a wide range of hypothetical strategies against the same set of data, which will also produce successes that fail in real-time markets because there are many invalid strategies that would beat the market over a specific time period by chance. One way to compensate for the tendency to data dredge or cherry-pick is to use a strategy that succeeds in the relevant, or in-sample, time period and backtest it with data from a different, or out-of-sample, time period. If in-sample and out-of-sample backtests yield similar results, then they are more likely to be proved valid.”
Another approach for Step 2 could be to split your historical dataset into non-overlapping, in-sample and out-of-sample datasets. In this case, you develop your trading strategy using the in-sample dataset, and validate it using the out-of-sample dataset. If the results between the two datasets are similar, you can go live with more confidence.
This meme explains it best.
Past performance does not guarantee future performance. If there’s one thing you should take away from backtests, it’s this. Market regimes change all the time. Strategies that showed exceptional returns in the past through backtests may not be as profitable in the future. Strategies that were once profitable, but not anymore, may yet become profitable again.
Even if we complete Steps 1 and 2 well, we can still lose money in Step 3. In fact this is an inevitability, as market regimes change over time, execution issues via slippages, etc.
Hello and welcome to the detailed pricing page for AlgoTest. You will find a breakdown of our pricing model here.…
Introduction Options trading can be lucrative for investors looking to diversify their portfolios and take advantage of market opportunities. However,…
While it is not the most common occurrence, sometimes the strategies you create can go into errors. In such situations,…
Exciting news for our traders: Candle Close Implementation has arrived at AlgoTest! To understand AlgoTest’s implementation of Candle Close here…
At AlgoTest, we are constantly innovating to bring our users the most advanced and user-friendly trading tools. So we are…
In our bid to provide additional support to traders in making trading decisions, we have now launched the feature 'Margin…
This website uses cookies.
View Comments
I want to know how will backtest result in following condition. Suppose I perform a backtest ,sell a call at 10am for 100 and set 20 points SL. At 10:23 candle price was OHLC is 118,122,116,117. Will the plateform consider SL hit or it will not consider it hit as closing price is less than SL price.