Hi Bobby, finnsk
I'll try to explain what happens before the market opens at 10am but the same process is followed during the closing auction (4:00-4:15pm) and before ANY pre-open auction.....ie...usually about 10 mins before a stock resumes after a trading halt for any reason.
The stock market goes into pre-open from 7am during which time anybody can put in whatever bids/offers they like (auction). During pre-open SEATS (Stock Exchange Automated Trading System) then goes thru a 4 stage algorithm to compute the IAP (Indicative Auction Price) based on the mkt depth whenever it changes. The IAP represents what the opening price would be at that particular time based on the current market depth if the stock opened for trading there and then.
At 10am stocks begin trading in alphabetical order. The market is fully open by about 10:08am. When the stock opens for trading, all orders with bids above the IAP and all orders with offers below the IAP are executed at the IAP. The IAP when the stock actually opens becomes the quoted opening price. During pre-open people put in bids above the IAP and offers below the IAP to ensure their orders are executed on opening.
At 4:00pm normal trading stops but again anybody can continue to put in whatever bids/offers they like until 4:15pm, just like in the morning preopen, but the orders aren't executed until 4:15pm. During the 15 mins closing auction SEATS again computes the IAP as above each time the market depth changes. At 4:15pm, for each stock all orders with bids above the IAP and all orders with offers below the IAP are executed at the IAP. In this case the IAP will be the quoted closing price.
I hope this makes sense and helps