US stocks closed flat to slightly higher on Wednesday after dipping in and out of negative territory for much of the session.

Shares in the discount bulk-retailer Costco Wholesale suffered their worst day since April 2005 after it cut its earnings forecast for the fourth quarter, as profit margins came under pressure from rising petrol prices. The stock shed 4.2 per cent to $47.18.

Nymex crude ticked higher but data showing unexpectedly high inventories of crude oil and gasoline still depressed energy stocks. Marathon Oil declined 3.4 per cent to $84.18 and Weatherford International fell 2.1 per cent to $43.35.

The Nasdaq was helped by gains from Ebay and Amazon, which added 4.7 per cent to $28.45 and 3.9 per cent to $30.67 respectively.

Chipmakers also staged a rally. National Semiconductor jumped 4.6 per cent to $24.80 and PMC Sierra added 5.7 per cent to $6.68.

At the close, the S&P 500 was unchanged, down 0.01 points at 1,304.27, and the Dow Jones Industrial Average was up 0.1 per cent, or 12.97 points, at 11,382.91.

The Nasdaq Composite fared slightly better, gaining 0.6 per cent, or 13.43 points, to 2,185.73.

US gross domestic product growth was revised up to an annualised 2.9 per cent in the second quarter from the first estimate of 2.5 per cent, roughly in line with analysts’ estimates of 3 per cent.

However, the data failed to give much impetus in either direction to the market, which traded nervously and without clear direction throughout the day.

Alfred Goldman, chief market strategist at AG Edwards, said investors remained cautious amid uncertainty over whether the economy faced a hard or soft landing after such a long bull market.

“The average bull market lasts 25 months, and this one has lasted 47 months,” he said. “This puppy is very long in the tooth.”

Mr Goldman added that given geopolitical uncertainty, equities were surprisingly resilient. “The market does well not to go down to zero and start over,” he said.

ADC Telecommunications, maker of telecom equipment, lost 7.3 per cent to $13.68 after it cut its full-year earnings guidance, and was lowered from “outperform” to “neutral” by Credit Suisse. The stock is down 40 per cent this year.

However, the rest of the telecoms sector was more buoyant. Motorola rose 1.8 per cent to $23.86 and Lucent gained 3.5 per cent to $2.38. The S&P Communications Equipment Index rose to its highest level for more than 10 weeks.

Electricity and gas distributor Public Service Enterprise Group sank 3.3 per cent to $68.58 after the company’s would-be purchaser Exelon said wrangles with regulators in the state of New Jersey were decreasing the likelihood that it would complete its proposed takeover.

Copyright The Financial Times Limited 2018. All rights reserved.

Comments have not been enabled for this article.