NEW YORK, NY - FEBRUARY 21: A stock trader reads a graph on the floor of the New York Stock Exchange at the closing bell on February 21, 2012 in New York City. The Dow Jones industrial average broke through the 13,000 barrier early Tuesday, the first time since May 2008 and closed just under that mark. (Photo by John Moore/Getty Images)

U.S. equities traded in a wide range on Wednesday after reaching all-time highs as tech stocks declined. The market’s high valuation also made some investors nervous.

The Dow Jones industrial average closed 55 points higher, managing a record close, after briefly falling 104 points. At its session high, the 30-stock index had risen 182 points.

The S&P 500 finished just below the flatline and fell as much as half a percent. The broad index had risen as much as 0.5 percent. Tech stocks declined 0.9 percent.

The Nasdaq composite dropped 0.6 percent.

Tech stocks were led lower by Apple, which fell 1.6 percent after Bernstein analyst Toni Sacconaghi predicted iPhone sales growth could be weak this spring. Shares of Facebook, Amazon and Alphabet also traded lower.

Equities have kicked off 2018 with strong gains. The major indexes are up at least 6 percent year to date as strong earnings and a lower corporate tax rate help maintain optimism in the economy.

But Jeff Kilburg, CEO of KKM Financial, said “the air is getting pretty thin up here,” adding: “This has truly been an extraordinary rally.”

Worries about further U.S. protectionist policies also gave investors jitters. Earlier on Wednesday, Commerce Secretary Wilbur Ross suggested the U.S. was ready to enter a trade war.

“In general, it’s starting to feel like you have four things. You have tariffs placed on solar panels and washing machines. You have the Treasury Secretary touting a weaker dollar,” said Art Hogan, chief market strategist at B. Riley FBR.

“You have Wilbur Ross talking about how trade wars are normal and the U.S. is willing to fight to the them, and you have NAFTA negotiations going on in real time.” Hogan said. “That’s enough for the markets to pause.”

Traders work on the floor of the New York Stock Exchange (NYSE) in New York.

Brendan McDermid | Reuters
Traders work on the floor of the New York Stock Exchange (NYSE) in New York.

The major indexes hit all-time highs earlier in the session as investors cheered better-than-expected quarterly earnings.

Abbott Laboratories, United Technologies, Baker Hughes and NBCUniversal-parent Comcast all reported earnings and revenue that beat analyst expectations.

“We’ve got a pretty good earnings season under way,” said Randy Frederick, vice president of trading and derivatives at Charles Schwab. “It’s early but the percentage of beats we’ve seen thus far is pretty good.”

Of the S&P 500 companies that had reported as of Tuesday morning, 77 percent have beaten earnings estimates, while 80 percent have topped revenue expectations, according to FactSet.

Investors also paid attention to the U.S. dollar, which hit fresh 2014 lows on Wednesday. The dollar index, which tracks the greenback’s performance against six major currencies, fell 0.9 percent to 89.50 on Wednesday.

Peter Cardillo, chief market economist at First Standard Financial, said the lower dollar “has commodity prices going through the roof.”

Crude futures rose 1.8 percent on Wednesday, hitting their highest level since December 2014. Gold futures, meanwhile, climbed $19.60 to settle at $1,356.30 per ounce.

Elsewhere, airline stocks fell broadly after United Continental’s growth plans raised concern it could drive down fares.

Shares of United Continental pulled back 11.4 percent, the biggest decliner in the S&P 500. American Airlines declined 6 percent, while Delta Air Lines fell 5.2 percent and Southwest Airlines dropped 4.7 percent.