NEW YORK (Reuters) - The Dow Jones Industrial Average and S&P 500 closed at their highest levels ever on Thursday although Wall Street relinquished bigger gains after President Donald Trump said he wants a strong dollar.

The U.S. currency .DXY erased losses against a basket of major currencies after Trump told CNBC in an interview in Davos, Switzerland, that he wants to see a strong dollar.

The dollar had suffered its biggest daily percentage drop in seven months on Wednesday after U.S. Treasury Secretary Steven Mnuchin said he welcomed a weaker currency. A weaker dollar tends to benefit large U.S. multinational companies.

Biogen Inc BIIB.O surged 2.09 percent after the drugmaker reported fourth-quarter revenue that beat Wall Street estimates on higher sales of recently launched drug Spinraza. The rise lifted the S&P healthcare sector .SPXHC 0.89 percent as one of the best-performing S&P groups.

Shares of Caterpillar Inc CAT.N fell as much as 3.5 percent and rose as much as 2.8 percent in the wake of its quarterly earnings. The stock ended 0.61 percent higher.

“If growth continues the way we expect, we should see a rotation out of these mega-cap tech companies and into more of the higher-leveraged value companies,” said Jack Ablin, chief investment officer at BMO Private Bank in Chicago.

“And Caterpillar is it.”

Traders work on the floor of the New York Stock Exchange shortly after the opening bell in New York, U.S., January 23, 2018. REUTERS/Lucas Jackson

Robust quarterly earnings and economic data have given Wall Street a strong start to 2018, with the three major indexes up more than 6 percent year to date. But the market’s relentless rise over the past year has some investors worried about a correction.

“It’s a market that ignores all bad news and thrives on good news. It’s scary. The correction is going to be cruel, cold and brutal when it happens,” said Jake Dollarhide, chief executive officer of Longbow Asset Management in Tulsa.

S&P 500 companies on average are expected to have increased their fourth-quarter earnings by 12.7 percent, according to Thomson Reuters I/B/E/S.

Of the S&P 500 companies that have already posted results, 78.8 percent have topped expectations, versus an average of 72 percent over the previous four quarters.

“It’s non-stop positive reinforcement that keeps pushing the market up,” said Frank Davis, director of sales and trading at LEK Securities in New York.

The Dow Jones Industrial Average .DJI rose 0.54 percent to end at 26,392.79, its highest close ever.

The S&P 500 .SPX ended 0.06 percent higher at 2,839.25, also its highest ever close. Earlier, it gained as much as 0.39 percent.

The Nasdaq Composite .IXIC declined 0.05 percent to 7,411.16.

Ford Motor Co F.N slumped 3.98 percent after the automaker posted a lower-than-expected quarterly net profit. Its bottom line was hurt by rising commodity costs and unfavorable currency exchange rates, and Ford said it expected more pain to come from higher raw material prices in 2018.

In extended trade, Intel INTC.O jumped 2.45 percent after the chipmaker reported its quarterly results. Starbucks SBUX.O fell 3.6 percent in extended trade following its report.

Volume on U.S. exchanges was 7.2 billion shares, compared to the 6.7 billion average over the last 20 trading days.