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 41.31 points higher at 26,252.12, managing intraday and closing records. The 30-stock index rose as much as 182 points and briefly fell 104 points.
The S&P 500 finished just below the flatline at 2,837.54 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 to 7,415.06.
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."
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.
—CNBC's Patti Domm contributed to this report.