In backtesting (nasdaq stocks), I make the assumption that I have the ability buy/sell each day at the opening and closing prices. Is this realistic?
I do know of a largish prop shop that (as of 2009) had a deal with their prime broker to trade Nasdaq ETFs at the closing price, in size, so long as they gave a few hours' notice of order size and direction and never cancelled. After commissions and fees, the price was naturally worse.
Generally speaking, you have to assume slippage, as mentioned by chrisaycock, and most shops miss the trade with some regularity.
Yes, you can get the opening print and closing print prices for NASDAQ stocks (and NYSE stocks for that matter) fairly reliably with MOO (market on open) and MOC (market on close) orders. There are some occasional discrepancies, but it tends to be fairly solid for backtesting.
As @ast4 points out, you won't actually know what price you're getting when you place the order -- you'll have to place it several minutes in advance. Where this gets a bit tricky is you won't know precisely how many shares to buy if you want to allocate say, exactly $1000, on a stock. You'll have to make an estimation. But since the variation can be in either direction, it shouldn't introduce a systematic bias over a large number of trades (assuming e.g. that your model places MOC orders independent of any price action near the market close).
@Chrisaycock , It should be noted that taking out the top order doesn't necessarily move the market by a non-negligible amount. For example, on a $150 stock, if there's an open sell order at \$150 X 1000 shares, and another at \$150.10 @ 5000 shares, you're not going to move the market much, and .10 / \$150.10 is less than 0.1% - negligible unless you're doing HFT.
@LeeSchmidt, I think a better indicator of a "big order" is the ratio of your order size relative to all the open orders that are relatively close in price to the NBBO. There's also a dark pool that you should consider, especially on large-cap stocks. The easiest way might be to look at volume vs. time (it's best if you can look at intraday volume vs. time but you could eyeball with daily volume). If the 30-minute volume is 10k, and you want to do even a 2k trade, you'll probably move the market. A \$500,000 trade on a company like AAPL won't make a dent in the price when it's average volume is 15 million shares / \$7 billion... but a \$500k buy could easily cause a short spike in some penny stocks.
First of all you need to be clarify what you mean by 'opening/closing price' are you talking about the last tick? The opening/closing auction price?
Let's say you're talking about closing auction price within the context of a backtest. The big question here is are you computing your trading signal based on that same price? If you are then there's a major issue with this in you've essentially introduced lookahead bias. Remember in order to get the closing auction price for most US equities you have to send out a MOC 15 minutes before the close. Therefore you can't possibly have the closing print to compute on and achieve execution at that price.
Final tick maybe, but you'll have to include a pretty substantial slippage assumption.