When the market closes, orders to buy and sell stock accumulate overnight. A person, for example, might get home from work and see that his favorite stock had a bad day. He decides to sell. He logs in to his brokerage account at night and types in his sell order. Millions of people enter overnight orders like this, and they all accumulate at the stock exchange, even though the market is technically closed to business.
There are two ways that NASDAQ and other stock exchanges could deal with the "overnight accumulation" of orders. The first would be for NASDAQ to open the market by running through all of the accumulated orders one by one as though they had happened in real time. Every order that comes in has a time stamp. NASDAQ could simply take each trade and add it, in time stamp order, to the matching engine (see How the NASDAQ Stock Exchange Works for details on the matching engine), and then let the matching engine do its thing. In this sense, the opening price would be set using a business-as-usual approach.
The problem with this method is that it would be completely different from the process used during the day. That's because, during the day, people can see and adjust the prices on their buy and sell orders in real time. That is, if you're trading while the market is open, you can place a trade and watch it. If it doesn't execute, you can change your price five minutes later to account for price fluctuations. If NASDAQ simply let the matching engine do its thing on the overnight orders, traders would not have that ability.
So instead, NASDAQ has come up with an auction approach called the opening cross. Here's how it works. In the morning, a computer program looks at all the orders that have come in overnight in each different stock. Based on those orders, the program picks a price level that would be the best opening price. However, it also looks to see if there's a trade imbalance. For example, if a company announced bad news after the market closed, there might be 10 times more sell orders than buy orders.
NASDAQ then broadcasts the price and imbalance information to its network of dealers with the goal of offsetting the imbalance. It then lets dealers place orders. This all happens very quickly, in a time window of two minutes or so, right before the market opens. Dealers can place orders, and those orders are factored into the opening price.
Using all of the orders that have accumulated overnight -- along with the dealer orders that come in to offset imbalances -- the computer system sets the opening price, and that's the price that the stock opens at when the clock strikes 9:30 a.m. NASDAQ designed this system with the goal of giving traders what it thinks is the fairest opening price for each stock.
Of course, the closing price of a stock is just as important. After all, when mutual funds report their values each day, they do it using the closing price of stocks. Moreover, news organizations broadcast closing prices to the world, and many people make their overnight buying and selling decisions based on closing prices. So, just as with its opening cross, NASDAQ uses a similarly rigorous closing cross process to determine the correct closing price of any given stock.
For more information on the opening and closing cross and related topics, see the links below.