In the past, I met several traders, that experienced live results completely different from their backtest results. The cause was a seeming triviality – too small stop-loss. Let me explain to you today, why this can be a problem, what to be aware of and how to avoid this danger. The following topic is just about those breakout strategies that are using STOP order to open a position and, at the same time, they are using too small stop-loss (this article is not about strategies using market order). What is too small stop-loss? Well, it depends on the market and the timeframe. But in general, it is a stop-loss smaller than the size of an average bar of our main timeframe. Let me give you an example – if we are using a 30-minute chart with an average bar value 250 USD, and our strategy is working with an 80 USD stop-loss, we are heading into a serious trouble. The live trading results might (and in most cases almost probably will) be totally different from those that we have from the backtest. Let’s take a look at the reason why.
This problem occurs when the stop-loss is so small, that some of the trades have entry order and stop-loss on the same bar. Let’s say we have an entry STOP order on the price 100 and also a stop-loss on the price 99. Now, imagine that the bar opens on 98.7, it goes to 100.1 and we open the long position – and the stop-loss is set up to 99. And all of this happens within the same bar – i.e. within this one bar, the entry order is activated, the position is opened and the stop-loss is set up.
Now it is important to understand why this can be potentially a dangerous problem. It is quite simple. There are several backtesting platforms which are not able to recognize, with the wrong setup or when the data resolution is not fine enough if the stop-loss was or wasn’t hit on an entry bar. In other words, there are certain situations when, in reality, the stop-loss was hit right after the position was opened, because right after the activation of the entry order, the market starts heading south. However, our backtesting platform evaluates the trade as a profitable one (from now on I will write about TradeStation as it is a platform that I primarily use). How is it possible?
Let’s continue with the demonstration of the situation described above. In this situation we can see the rising bar, i.e. the one that has a close price above open price and, at the same time, the close is close to its high.There is an assumption that the bar was raising the whole time and TradeStation assumes that the “inner” move of the bar, i.e. the way the bar was generated, was constantly rising, a straight line.
TradeStation is simply following the logic that when the bar closed close to its high, the process of generating this bar was rising. In such situation, TradeStation assumes that the bar opened on 98.7 and the price was continuously rising to 100.4. And during this time, it also activated our buy order on the price 100.
Nevertheless, this is very inaccurate and dangerous assumption. What if the bar was first rising, activated our purchase order, but then it reversed and went back down, below our stop-loss, and then started rising again to close to its high?
This is a totally realistic scenario that is happening every single day and that would result in a clear loss (right after we open the position) – and yet, TradeStation (and potentially also other software), defines the situation as if there wasn’t any correction inside the bar at all. So no stop-loss was hit and trade ended up as a profitable one. This is the root cause to major problems as in the backtest you clearly see a lot of profitable trades that, in reality, would end up as losses – and right after we start trading this strategy live, everything starts falling apart…
Luckily the situation isn’t so serious as it looks like and the backtesting platforms, in general, take this risk into consideration.
The first protection against this threat is simple and, to a certain level, highly efficient. TradeStation calls it LIBB (Look-Inside-Bar-Backtesting), others call it different names, like Bar Magnifier. The point is that when you turn on this feature, the program looks inside the bar to the level of the finest available data resolution (in most cases it is 1 minute), if there wasn’t any inside correction after the entry order was activated, or if there was a correction on the same bar when we entered and the stop-loss was hit.
Despite that it sounds like a great solution (which is today a standard part of most platforms), it doesn’t have to be sufficient when it comes to small stop-losses. Why? Imagine a situation when your stop-loss is 80 USD, but the average bar of your finest LIBB resolution (i.e. mostly 1 minute) is 150 USD big. In this case you are experiencing the same problem as described above, when the platform is not able to determine whether the stop-loss inside the bar was hit or not and it makes, again, just an inaccurate approximations that are driven by the above-described logic – if the bar closed closer to its low or closer to its high. In other words, you are again at the beginning and with too small stop-loss, not even LIBB will help you, and the problem still persists.
So, we are getting to the point when we need to go a little bit deeper to solve this problem.One of the solutions would be to use even finer data resolution – down to the tick level. But this isn’t as easy as it sounds. Firstly the tick data history is not so easily accessible, or just for a very short period. And if these data are available, they are really expensive. But even if you still purchase tick data, you need to solve several technical issues – as the tick data are usually so big, that most of the platforms won’t handle so many data, crashes or runs backtests incredibly slow (I can confirm this).
So we need to use much simpler solution – and that is the necessity to use reasonably big stop-loss. And what is reasonably big stop-loss? Simply use stop-loss that is at least 1.5-2x bigger than the biggest 1-minute bar on your chart. It is simple and you can avoid several problems. For example, if the biggest 1-minute bar for all your data history was 300 USD, use stop-loss at least 450 USD. Period.It is simpler and safer to get used to higher stop-losses than lying to ourselves and subsequently be surprised why such a nice backtest equity is quite the opposite of results of live trading.