A weak showing in home sales and a mixed batch of earnings reports kept stocks flipping between minor gains and losses on Wall Street. By the end of the trading session Thursday, the major indexes eked out their second day of gains this week.

A strong profit report from Procter & Gamble helped indexes start higher, but stocks weakened after a Realtor group said the pace of new home sales contracts had leveled off.

advertisement | advertise on newsday

The Dow Jones industrial average gained 26.34 points to close at 13,103.68.

"This is a market still working through a difficult earnings season," said Jason Pride, director of investment strategy for Glenmede, a wealth-management firm. He said investors probably celebrated too much after the Federal Reserve pledged more support for the economy in September. They overlooked shrinking economies in Europe, slower growth in China and other signs that this earnings season would be rough. In the past two weeks they've paid for it. "We had a party, and now we're dealing with a hangover," he said. "The market is basically back to where it was at the end of August. I don't think that's unreasonable."

In other trading, the Standard & Poor's 500 rose 0.03 percent to 1,412.97, and the Nasdaq gained 0.15 percent to 2,986.12.