Since we have started AlgoTest.in, we’ve received countless messages from users asking how its possible that their backtest loss higher than stop loss value? Specifically, the questions take this form:
The answer is the same for backtests and the real world – yes it is possible! And no, it’s not a bug!
We would even go a step further and say, not only is it possible, but it is inevitable, in the fictional world of backtests, and in the world of actual trading. If any backtesting software or system tells you otherwise, either they’re misinformed, or they’re lying.
In the world of backtests, we represent a constant flow of market data that your broker API receives as candles. A candle has the wonderful property of compressing all market activity over any period into 5 distinct data points – open, high, low, close and volume. With the benefit of this compression, however, comes a cost. The cost is loss of data. Once you go from 1-second granular LTP data to a 1-min candle, you’ve essentially distilled 60 price data points into 4.
This data loss can seem magnified during particularly volatile period, as it can introduce large discontinuities between the price of two candles. A cursory look at Zerodha chart shows an intra-day gap down discontinuity we found:
On 22 Feb’22 14:41, the close price of the candle was Rs 198.20, the open price of the next candle was Rs 196. If your Stop Loss was set between these prices, our platform assumes your SL got hit at the open price of the next candle. Here, the gap in the two candles isn’t much, only ~2 rupees. BUT, it can be much larger during periods of volatility.
We actually came across a user who showed us a backtesting report from some other service that showed an overall loss exactly equal to their MTM SL EVERY TIME the SL was hit. BUT, when we totalled the PnL manually at the individual leg level, we noticed that the actual loss was 2.5 times the reported MTM SL loss for some of the trades!
So if you ever see a backtest report where your loss reported on a trade is always less than or equal to the SL level you set, BE WARY! If you see such a backtest report,
In the real world as well, this is an inevitability. To keep it simple, here’s a tweet that shows an extreme scenario of what can happen in the market.
Now you can decide whether you want to use LTP or Candle Close for your Live Trades and Forward Tests. We recommend using the Candle Close setting in order to match more closely to your backtests. Again, as we have shared above, there are no guaranties that your backtest results and your live trade results will match. In fact it’s almost inevitable that they won’t. But this will help you get closer.
Click here for additional information.
Pros of Candle Close | Cons of Candle Close |
– Your backtests and live trades will be executed on the same settings. This increases the chances of them being closer. | – Your backtests will be executed on Candle Close and your Live Trades will be executed on LTP. This will lead to more differences in the outcomes. |
— Raghav (@rogue_hft) September 3, 2021
Introduction Option trading can be a real brain teaser. Figuring out what trades to make, doing them exactly right, and…
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,…
Introducing Our New Error Handling Feature At AlgoTest, we're excited to announce a significant upgrade to our platform with the…
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…
This website uses cookies.