Let's say you have only interval data (open, high, low, close) on which to perform your backtesting (i.e. no tick data).
And let's say your system wants to enter long at the high of the most recently closed bar, and it wants to set it's stop loss at the low.
And let's say the following bar has a higher high than the one used for the entry and stop loss calculations, and a lower low. There are three possibilities here:
Firstly, the price may have first risen above the high of the previous bar, thus triggering the long entry. We're in the trade. And then the price dropped below the low of the previous bar, thus trigging the stop loss. We're out of the trade at a loss.
Secondly, the price may have first dropped below the low of the previous bar, thus triggering nothing because the stop loss doesn't come into effect until we're in the trade. Then the price rose above the high of the previous bar, thus triggering the long entry. We're in the trade.
Thirdly, the price may have first dropped below the low of the previous bar, thus triggering nothing because the stop loss doesn't come into effect until we're in the trade. Then the price rose above the high of the previous bar, thus triggering the long entry. We're in the trade. And then the price dropped below the low of the previous bar, thus trigging the stop loss. We're out of the trade at a loss. While unlikely, in fact the price could have rebounded many times between the high and low of the bar during the time the bar was formed - there's no way to know if tick data is not available.
This third scenario forces us to have a policy of once being stopped out of a trade, we wait for the bar to complete before calculating a new entry point (as opposed to using the old entry price calculation to get back into a trade if the price rises to that level once more). That's my policy, anyway. Backtesting would be impossible without it as we would not be able to predict the results in this situation.
Anyway, the first and second scenarios alone highlight a problem with backtesting using interval data. Two completely seperate outcomes are possible. And so, I think there is no other option but to either (a) track both possibilities and show two sets of results at the end of the test; or (b) always assume the worst case - that the price first went in a direction in order to get us in to the trade, and then went in a direction that took out the stop loss.
Feel free to ask questions if I didn't explain that very well.
Scalping techniques
All that means some valid trading systems cannot be backtested. (These are different to Impossible Trading Systems which can be backtested, but can't actually be traded).
For example, scalping techniques are generally always exiting their trades in the same bar that they entered the trade. Unfortunately this means any scalping techniques have to be backtested using tick data, rather than interval data.
But, if you're looking to enter the scalping business, it's probably worth your while to go through the extra steps necessary to backtest using tick data.
Next:
Getting The Bid & Ask Mixed Up
Prev:
Forgetting The Spread
The Problems With Backtesting Index