I'm backtesting an algorithm for trading nasdaq stocks, and would like to take into account the spread. I am using historical data from yahoo, which contains:

open, high, low, close, volume, adj. close

All of my trading signals are based off of those prices as they are (without regard to whether they are bid, ask, best bid, best ask, etc.)

To attempt to take into account the bid/ask spread when executing a trade, I have treated all the prices above as the bid prices. To estimate the ask price, I decided to set the spread always equal to 1% of the previous day's high. So the ask price is just estimated by adding that spread to the bid price (and again, the bid price is equal to the yahoo prices given).

Under what conditions is this a reasonable estimate for the spread? For example, very low priced stocks have larger spread percentages so I exclude those stocks completely from my backtesting.

Any better way to do this?

Thanks

-
show 1 more comment

As @babelproofreader mentioned, I recently blogged about the Roll model (see the original paper), which provides a very simple method for inferring the bid/ask spread based on trade prices. In short, you can estimate the cost using using the covariance: $c = \sqrt{\gamma_1}$. Where $\gamma_1$ is the $Cov(r_t, r_{t-1})$. (The R code is provided in my post).

The Roll model makes many simplifying assumptions and is an empirical failure (although still theoretically important), so I would not advise using it as a real proxy for costs. There have been many advancements since that original paper. Two better options:

[I may blog further on this topic in the future, but it doesn't seem as important as other topics given the ready availability of actual bid/ask spread data.]

-
 Welcome back, Shane! – chrisaycock♦ Oct 10 '12 at 1:37 Thanks, Chris! Might try to poke my head in a little more. – Shane Oct 10 '12 at 1:58

This recent Statalgo blog post outlines a simple theoretical model of bid/ask prices: the Roll model, and also shows how the bid/ask spread can be derived from prices using this model. Included in the post are links to papers that show how this model might be improved.

-
You could provide summary of what's in the blog.... – SRKX Oct 8 '12 at 14:19