I have built a trading strategy and also a backtest. The backtest has been a lot of work. I was using mid-prices throughout. It’s based on candles, so I make trading decisions at the end of each bar. Recently I changed it to use the bid and ask. So for example to decide if a trade was stopped out I now use the bid/ask high or low (depending if I’m long or short) of the previous bar, rather than the mid high/low. Now, I’m getting much worse test results. It’s possible that due to complicating the backtest code i have introduced bugs. I am wondering if others are backtesting based on mid rates, and then do a forward test as the main stop/go flag. Intuitively I am thinking that I don’t want to have too much code in the backtest to keep it simple, then do most testing in the forward test. But on the other hand I don’t want a useless backtest since I intend to use it to develop new trading strategies quickly. Have others implemented full stop loss management in their backtests, or is this over complicating it? Have you made simplifications such as using mid-rates rather than bid/ask everywhere?
I once did a backtest of a very interesting strategy that involved frequently (every few days) trading credit default swaps. If I assumed that I could execute at mid, then the strategy made decent returns. However if I assumed 5 bps bid-ask spread (i.e. only 2.5 bps above and below the mid - somewhat optimistic), then the strategy lost money.
My advice to you is to look at both what your strategy would do if you could execute at mid, and also what it would do if you included the bid-ask spreads that you observe now, or have history for. Further, a stress-test assuming much wider bid-ask is always a good practice.