Stocks erased their earlier gains by Tuesday's close as lower oil prices and a fresh terror scare in Germany rattled the markets.

The S&P 500 fell 0.04%, the Dow Jones Industrial Average increased 0.10%, and the Nasdaq was up 0.07%.

Stocks rallied in the morning as retailers posted positive earnings. But the weak energy sector has been holding the market back, said Matt Weller, senior market analyst at U.S. crude oil fell 2.37% on Tuesday to $40.75 a barrel.

"It's kind of a stock pickers day, where certain sectors and markets are doing much better than other ones," Weller said. "The overall indices are masking the differentiation."

A soccer match between Germany and the Netherlands was canceled during the afternoon after officials said they had "received a serious tip that an explosive attack was planned for the stadium."

The drop in oil prices pushed the utilities and energy sectors lower by the close, with utilities down 1.9% and the energy dropping 1.07%.

Chesapeake Energy(CHK) - Get Report sunk over 7.5%, Cabot Oil & Gas (COG) - Get Report  fell nearly 6.4%, while Duke Energy(DUK) - Get Report  slid almost 3%.

The Consumer Price Index, after declining for two months because of lower energy and import costs, increased by 0.2% in October.

Industrial production for October fell by 0.2%, after two months of declines, but manufacturing output showed some improvement, rising by 0.4%.

The NAHB Housing Market Index, an index of homebuilder sentiment, slipped in November by 3 points to 62.

Weller said that the mixed economic environment will likely lead to a slower trading day on Tuesday, but Wednesday's release of the minutes from the October meeting of the Federal Open Market Committee could provide more clarity.

"With that mixed data, it's not negative enough to throw the Fed off the track of raising interest rates in December," he said. "Traders are really desperate for some sort of certainty."

Walmart(WMT) - Get Report shares gains about 4% after third-quarter earnings at the world's biggest retailer came in at $1.03 a share and beat forecasts. Revenue of $117.41 billion missed forecasts by a slight margin.

Home Depot(HD) - Get Report shares jumped more than 4.2% after the home-improvement retailer's third-quarter earnings and revenue topped Wall Street forecasts. Same-store sales in the period rose 7.3%.

TJX (TJX) - Get Report rose around 4% after it posted quarterly earnings that beat forecasts. Same-store sales at the retailer increased 5%.

Dicks Sporting Goods(DKS) - Get Report fell over 10% after it slashed its profit guidance for the fourth quarter and year.

Airgas (ARG) climbed close to 29% on reports that Air Liquide will announce a deal to purchase the company. A combination would create the world's largest industrial gases supplier, according to Bloomberg.

Urban Outfitters (URBN) - Get Report plunged more than 4% after the company reported earnings of of 42 cents a share, meeting analysts expectations, but revenue of $825 million came in below estimates.

GNC Holdings(GNC) - Get Report dropped almost 6.5%, Herbalife(HLF) - Get Report fell more than 0.9% and Vitamin Shoppe(VSI) - Get Report fell 3.59% after reports said the Department of Justice plans to announce criminal and civil actions against dietary supplements companies. 

Angie's List(ANGI) - Get Report fell by more than 0.7% after it rejected a buyout offer from IAC/InterActiveCorp (IACI) .