Stocks ended a volatile day with strong gains Tuesday after taking a sharp nosedive in midday trading, following a false Twitter post of two explosions in the White House.

(After-Hours Buzz: AAPL, YUM, AMGN & More)

Stocks took a steep plunge following a false AP tweet that indicated that the White House had been the victim of an explosion and that President Obama had been injured. The AP confirmed its Twitter account was hacked and the spokesman said the tweet was "bogus." The Twitter account was suspended shortly after the fake tweet.

(Read More: Hackers Compromise @AP Twitter Account)

White House Press Secretary Jay Carney held a press conference shortly following AP's Twitter post, saying "the President is fine."



"That goes to show you how algorithms read headlines and create these automatic orders – you don't even have time to react as a human being," said Kenny Polcari of O'Neill Securities. "I'd imagine the SEC's going to look into how this happened. It's not about banning computers, but it's about protection and securing our markets."