Stocks ended another volatile week on a positive note as investors were cheered by President Bush's plan to help distressed homeowners and Fed Chairman Ben Bernanke's stance that the central bank will act as needed to address credit concerns.
The Dow Jones Industrial Average posted a small weekly loss of 0.2%, the S&P 500 fell 0.4% and the Nasdaq Composite advanced 0.8%.
For the year, the blue chip Dow index remains up 7.2%, the benchmark S&P 500 is up 3.9%, and the Nasdaq has gained 7.5% year to date.
Stocks closed down on Monday as a decline in financial stocks weighed on the major indexes.
Existing home sales slipped 0.2% in July as inventories swelled 5.1% to a 9.6-month supply of homes on the market. The July data reflects deteriorating selling conditions even before the credit crunch hit the markets in August.
"We might trade in a range here as the market digests the expense of the housing bust and the subprime crisis," said Brian Hicks, president of Wealth Daily, an investment newsletter. "The market was looking for a reason to correct. Now it's looking for a reason to rally."
Shares of financial companies such as Bear Stearns , Lehman Brothers and JP Morgan Chase closed sharply lower as investors remained worried about global credit markets.
Stocks swooned on Tuesday following the release of minutes from the Federal Reserve's early August policy meeting and all three major U.S. indexes closed with losses of more than 2%.
"The comments from the Fed not indicating that a rate cut was imminent and further deterioration in the financial sector -- all of this combined and we're down substantially here," said Brian Schaeffer, an NYSE floor specialist at Van der Moolen.
"Lack of volume is certainly part of it, but there are not a lot of big institutions out there deploying their capital right now in order to stabilize these markets," Schaeffer added.
Stoking credit concerns, it was reported that Boston-based money manager State Street has as much as $22 billion in exposure to packages of retail and commercial loans backed by short-term debt.
MedcoHealth Solutions said it will acquire diabetes care providerPolyMedica for $1.5 billion in cash. Medco, the largest drug benefits manager in the U.S., will pay $53 a share, a premium of 17%.
Stocks ended broadly higher on Wednesday as investors went bargain-hunting amid hopes the Federal Reserve will cut interest rates.
"You had more people positive today that the Fed is going to cut rates," said Todd Leone, head of listed trading at Cowen & Co. "A lack of bad news is really the main thing moving the markets today -- as long as you don't hear anything negative, the market does OK."
Breadth was positive with advancing stocks outpacing declining stocks by an almost six-to-one basis on the NYSE. All 10 economic sectors tracked by S&P moved higher, with gains led by energy, industrials and technology.
All 30 stocks in the Dow Jones Industrial Average traded higher. Gains in the Dow were led by tech stocks such as Intel and IBM, as bargain hunters snapped up the biggest technology names.
Altria Group said it will spin off its international tobacco unit, Philip Morris International, as widely expected.
Shares of Apple moved higher after the company said it will launch a new product on Sept. 5, prompting speculation the company will unveil a new line of iPods, including a highly-anticipated widescreen version of the popular portable music player.
Stocks closed mostly lower on Thursday, ending a choppy trading session that had investors looking ahead to Federal Reserve Chairman Ben Bernanke's speech Friday, his first public remarks since the Fed lowered discount rates in mid-August.
"Volume was very light but without extreme volatility," said Scott Fullman, director of investment strategy, for IA Englander. "We stayed on the negative side for much of the session with people adjusting positions going into the weekend."
Fullman said, "the main attraction for the market tomorrow will be Bernanke, and then the focus will be on getting away for the long weekend."
The bright spot in the market was a variety of technology stocks, seen as being less exposed to debt problems, which enabled the Nasdaq Composite to chalk up a modest gain in the Thursday session.
Wal-Mart Stores led the Dow lower after Merrill Lynch cut its shares to "sell" from "neutral," saying its operating margins are likely to compress further.
Financial stocks were lower, with notable weakness for brokers such as Bear Stearns, Goldman Sachs, Merrill Lynch and Morgan Stanley, which fell after Lehman Brothers cut earnings estimates on the group, citing tough credit and mortgage markets.
Stocks rallied on Friday after Fed Chairman Bernanke acknowledged expanding trouble in the credit markets.
"Bottom line, he reaffirmed the Fed's bias towards easing," said Mark Zandi, chief economist at Moody's Economy.com. "I do think he'll get more economic data, and the anecdotes will add up to some Fed easing by the September meeting ... I don't see any way around that."
The head of the central bank gave a blunt assessment of the credit situation, saying financial stress is not confined to the mortgage markets. The Fed was prepared to act if needed, said Bernanke, who stopped short of committing to an interest-rate cut.
President Bush's plans for reforms to help homeowners with subprime mortgages avoid default also contributed to positive market sentiment. Meanwhile, investors were encouraged by economic data that showed an increase in personal income and spending, but tame inflation numbers.
Peter Kang is a markets writer at CNBC.com and can be reached at firstname.lastname@example.org.