The Dow industrials and the S&P 500 index made new yearly highs on Wednesday after data showed China industrial output surged and Federal Reserve officials hinted money would remain cheap well into 2010.

But stocks were off their morning highs as the U.S. dollar reversed course and rose against a basket of currencies after hitting a 15-month low. The turnaround weighed on dollar-denominated commodities and natural resource stocks that had been among top gainers.

Chinese factory output rose to a 19-month high in October, sparking a wave of buying in commodities as investors bet the data was a herald of growing demand in the world's third-largest economy.

Shares in Nucor Corp , a big U.S. steel producer, rose 2.7 percent to $41.84, while the Dow Jones iron and steel index <.DJUSST> rose 2.4 percent.

Comments from top Fed officials that the U.S. recovery would be bumpy underscored the view that interest rates will stay low and economic stimulus will remain intact, a boon for the stock market in the short-term.

In addition to the economic data showing that things are getting better you also have seemingly all the policy makers in the world on a coordinated basis trying to keep this recovery going, said Eric Kuby, chief investment officer at North Star Investment Management Corp in Chicago.

The S&P 500 has risen for seven of the last eight days at a time when the U.S. unemployment rate has jumped to more than 10 percent.

The Dow Jones industrial average <.DJI> gained 29.93 points, or 0.29 percent, to 10,276.90. The Standard & Poor's 500 Index <.SPX> rose 4.00 points, or 0.37 percent, to 1,097.01. The Nasdaq Composite Index <.IXIC> added 10.98 points, or 0.51 percent, to 2,162.06.

The outlook from the corporate front gave a mixed picture of the economy.

United Parcel Service Inc , the world's largest package delivery service, gained 1.6 percent to $57.75 after its chief executive forecast volume to grow next year as the global economy gradually recovers.

But shares in Macy's Inc , the department store operator, tumbled 8.6 percent to $17.77 after the company reported third-quarter results that were stronger-than-expected but gave a gloomy outlook on same-store sales for the fourth quarter.

Homebuilders were up sharply as Toll Brothers Inc gained 14.7 percent to $21.10, following the company's release of preliminary results on Tuesday. The Dow Jones homebuilders index <.DJUSHB> rose 6 percent.

Volume and trading are expected to be light throughout the day because of the Veterans Day holiday. The U.S. bond market and government offices are closed, while other markets will trade normally.

(Editing by Padraic Cassidy).