I'm backtesting a trading strategy, using free OHLC data from yahoo or google. I'm simulating friction by lopping a flat percentage (say 0.5%) off my returns for each day that I make a trade. Whats a good way to simulate slippage? I tried 'torturing' my returns, by pretending that I always buy at the day's high and sell at the day's low, but that was depressing. Is there a good compromise between naively assuming my trades execute at the day's close and 'torturing' my trades?
Slippage is multi-facetted, however, I think the main element to slippage is going to depend on the sophistication of your execution approach. Also, in your case there are 2 types of slippage:
- execution slippage (i.e. cost above mid to get your fill)
- tracking slippage (how much price difference between actual close and your fill price)
Here are a few ways one might try to execute near the close price (I'll assume the use of limit orders). Each of these has a different impact in terms of execution slippage:
- put in a very aggressive order in the final minute(s) that is priced to cross deep into the ask book (if buying) or bid book (if selling). By deep mean buy at ask + some price enrichment such that if the inside book is taken out before your order is received you still obtain a fill.
- project some closing price estimate before EOD and put in a standing order for that price some period before close
- try to cross aggressively on the inside price, adjusting order at high-frequency
The first approach may have the most execution slippage, but does not require HF order placement and replacement. The second is optimal in terms of execution costs, but projected target may deviate from actual close. The 3rd is tighter than the first (often) in terms of execution costs, but requires HF data/execution to do well.
I don't believe an analytic approach on OHLC will ever work as cannot determine without seeing the microstructure or intraday price action. For instance consider trying to buy near the close in each of these scenarios:
- upward momentum
- downward momentum
- sideways / flat
If one attempts to buy in upward momentum you will be chasing price and will likely need to enrich your order significantly to get a fill (hence more slippage). (this is the most frequent scenario, since if you are buying there is probably reason for others to be as well).
If one is buying in downward momentum then the fill is incredibly easy to do, as the market is biased towards sellers. Hence a passive order (such as buying at the bid) or even bid - some spread is likely to be filled.
If price action is sideways passive (at the bid) or aggressive orders (crossing to ask) should both be effective and hence have low execution slippage.
Slippage is a function of execution approach and local price action behavior (vol, buyer/seller bias, etc). So, in my view you should obtain higher-frequency data and simulate your signal and execution algo to get an accurate picture. This will not be wasted in that the same logic can (and should) be used to automate your execution.
If you are looking to do large size, then your execution algo will be something more complex where you make multiple buying (selling) entries into the market.
You can use MOC (Market on Close) orders to realize the closing price on NYSE or NASDAQ. The price you get will be the official close. You should check to see whether the free data you are getting contains the consolidated (last price across all venues) or primary (last price on the primary listing exchange for the stock) for its closing prices. If it contains consolidated prices then you could find that you realize different prices than your backtest. It should still be relatively close however.