Stocks Log 3-Day Gain, BofA Surges 11%

Stocks rallied strongly in the final hour Wednesday, logging a three-day gain, after hovering near the flat line for most of the session, but investors remained cautious ahead of Federal Reserve Chairman Ben Bernanke's Jackson Hole speech at the end of week.

The Dow Jones Industrial Average jumped 143.95 points, or 1.29 percent, to close at 11,320.71, in a volatile trading day. The blue-chip index crossed the flat line almost 15 times during the trading session.

BofA and Home Depot gained, while ExxonMobil was the only decliner on the Dow.

The S&P 500 rallied 15.25 points, or 1.31 percent, to end at 1,177.60. The Nasdaq rose 21.63 points, or 0.88 percent, to finish at 2,467.69.

The CBOE Volatility Index, widely considered the best gauge of fear in the market, traded around 35.

All 10 S&P sectors finished higher, led by financials and utilities.

“Yesterday’s rally was about 30 to 40 percent short-covering and I would be very careful going into Friday,” Art Cashin, director of floor operations at UBS Financial Services told CNBC. “There could be a big surprise from Bernanke by saying nothing, and that could catch the markets off base.”

Many investors are awaiting Federal Reserve Chairman Ben Bernanke's speech on Friday at a banking conference in Jackson Hole, Wyoming, in hopes that he may announce some form of monetary policy to help support the U.S. economy.

Meanwhile, gold tumbled sharplyto settle below $1,760 an ounce, falling more than $100 as investors took profits after the metal's strong rally. (Read More: Is Gold Overbought?) Technical traders are watching $1,758 as the key support level for gold. Gold miners including GoldCorp and Barrick Gold declined.

“I would be looking to buy gold in this dip—You have to be a contrarian to make any money in this market,” Matt Cheslock, senior specialist at Cohen Capital Group told CNBC. “When things are bad, you have to be looking at the positive outlook and buy the dips—everyone’s so negative right now."

Bank of America soared after Raymond Jamesreiterated its "strong buy" rating on the firmwith a price target of $16. The stock had declined sharply in the last few weeks, tumbling to fresh 52-week lows in the previous session, amid ongoing worries that the bank may need to raise capital to absorb billions in mortgage losses.

Meanwhile, Goldman Sachs and Citigroup engaged Moody's Investors Service to rate their $1.5 billion commercial mortgage-backed securities, according to sources. Both stocks finished higher.

JPMorgan and MorganStanley also gained as investors snapped up financial giants that have been beaten down in recent months.

On the tech front, Google will be asked to pay $500 million to settle government charges that the search-engine giant has illegally shown online pharmacies ads that operate outside the law, according to sources. Meanwhile, Baird started coverage of the firm with an "outperform" rating and a price target of $650.

Meanwhile, Research In Motion rose following reports that the smartphone maker will run Android apps on its new QNX Blackberry phones.

Among earnings, Toll Brothers gained after the luxury homebuilder beat profit expectations, but the firm narrowed its home delivery outlook for the year as it expects the housing sector to remain in a tepid state.

BHP Billiton edged higher even after the global miner posted earnings below expectations. However the firm announced a bigger-than-expected dividend.

Applied Materials and TiVo are slated to post earnings after-the-bell.

Treasurys held their lossesafter the government auctioned $35 billion in five-year notes at a high yield of 1.029 percent and a bid-to-cover of 2.71.

Volume was lighter than usual with the consolidated tape of the NYSE at 4.48 billion shares, while 1.11 billion shares changed hands on the floor.

On the economic front, durable goods orders jumped more than expected in July, according to the Commerce Department.

“The market here is struggling to decide how much credibility to give the durable goods orders this morning,” Cashin said. “The regional Fed data indicates a much weaker economy out there than what the durable goods indicate.”

However, U.S. home prices climbed a seasonally adjusted 0.9 percent in June, but are still down 4.3 percent in the past year, according to the Federal Housing Finance Agency index.

Weekly mortgage applications slumped to almost a 15-year low last week, according to the Mortgage Bankers Association.

Meanwhile, the federal budget deficit is expected to hit $1.28 trillion this year, down slightly from the previous two years, according to the Congressional Budget Office.

European shares hit a one-week closing high, boosted by hopes that Bernanke could signal further stimulus measures to help the economic recovery.

And Moody's Investors Service cut Japan's credit rating by one notch to Aa3 from Aa2, citing large deficits and government debt.

—Follow JeeYeon Park on Twitter:

Coming Up This Week:

THURSDAY: Weekly jobless claims, 7-yr note auction, Medtronic shareholders mtg, USDA food prices outlook; Earnings from Hormel, Pandora
FRIDAY: GDP, corproate profits, consumer sentiment, Bernanke speaks, short-sale bans expire; Earnings from Tiffany

More From