Wall Street managed to dig itself out from under an avalanche of bad news today, clawing back from a 150-point deficit in the Dow Jones industrial average to end the day with a surprising 26-point gain.

Analysts who had spent the entire day explaining why stock prices were plunging were forced to, as they say in Congress, "revise and extend their remarks" to reflect what happened in the final two hours of trading.

"Bargain hunting" and "technical factors" were the answers.

When stocks hit new lows for the year at mid-day, traders confident that the economy is gaining strength stepped forward and started buying.

The rebound came as the familiar stock indexes drifted toward the statistical benchmarks tracked by mathematically minded traders who study the gyrations of the market in the abstract rather than in relation to corporate events or the economy. Technical traders do their buying and selling based on charts and mathematical models, and today those tools apparently told them to do some buying.

The Dow did the most dramatic turnaround, rebounding from the 9,900 level to close at 10,045.16. The Standard & Poor's 500 stock index transformed its losses into what was basically a break-even day, closing up less than 2 points at 1,097.28.

The Nasdaq Stock Market composite index never quite made it back to break even, but recovered from a 50-point deficit to end the session off 6 points at 1,925.59.

What pushed the market so low was an avalanche of bad news: the highest oil prices in 13 years, the worst trade deficit ever and another day of out-of-control violence in the Middle East.

The gloomy developments fit together so neatly that Wall Street couldn't sort them out: The war in Iraq contributes to soaring energy prices, which make the trade deficit worse, which undercut the stock market.

Reinforcing the malaise that hangs over Wall Street were front-page pictures of the sobbing father of the young American beheaded in Iraq. Reports that another bombing in Gaza killed five more Israeli troops, nearly two dozen Iraqis were killed in renewed fighting there and more Iraqi prison abuse photos were shown to members of Congress only darkened the mood.