I have two backtesting algorithms:
- One that uses bid and ask prices for signal generation. For example: Buy when $ask < threshold_1 $ and sell when $bid > threshold_2$. Bid and ask prices are calculated from the closing price using a 20 basis-point spread.
- One that uses closing prices for signal generation. For example: Buy when $price < threshold_1$ and sell when $price > threshold_2$. The 20 basis-points bid-ask spread is taken as a transaction cost and subtracted from the P&L.
The two alternatives give me different results. I guess that the first backtesting algorithm is closer to reality, but the second (i.e. considering bid-ask spread as a transaction cost) is common among the literature.
What's the rationale of considering bid-ask spread as a transaction cost and which of the two alternatives should I use?
PS: I'm backtesting a mean-reverting pair-trading strategy of liquid ETFs.