Financial Markets Wall Street

In this Oct. 29 photo, specialist Gregg Maloney, left, and trader John Panin work on the floor of the New York Stock Exchange. Stock indexes closed Friday with gains.

NEW YORK — The stock market capped another week of healthy gains on Friday, but it ended on more of a befuddled note than a bang as confusion about the U.S.-China trade war hung over the market.

Stocks wobbled between small gains and losses through the day amid conflicting signals about the progress being made by U.S. and Chinese negotiators. President Donald Trump said he has not agreed to roll back any tariffs, just a day after a Chinese official said the two sides had agreed to do just that if talks progress.

Stocks and bond yields dipped immediately after Trump told reporters at the White House, “I haven’t agreed to anything.” But after flip-flopping through the day, the S&P 500 turned higher in the last hour of trading and closed at a record 3,093.08, up 7.90, or 0.3%.

It’s the fifth straight week of gains for the index, which matches its longest winning streak in the last two years.

The Dow Jones Industrial Average edged up 6.44 points, or less than 0.1%, to 27,681.24, and the Nasdaq composite gained 40.80, or 0.5%, to 8,475.31.

“The general tone of the market will continue to be very cautiously optimistic,” said JJ Kinahan, chief market strategist at TD Ameritrade.

Even with the conflicting signals on the trade war, momentum has seemed to be in the direction of a stopgap deal. Wall Street hopes only that it will keep the trade war from worsening: Another round of tariffs on Chinese goods is scheduled to begin next month. Investors aren’t expecting a grand bargain anytime soon that solves all the problems between the world’s two largest economies.

Economic reports, meanwhile, have been encouraging recently and show the job market remains strong. Interest rates are low following three cuts by the Federal Reserve, and corporate profits haven’t been as bad as Wall Street feared.

Rising confidence can be found not only in record-high stock prices but also in a sharp rise for Treasury yields. When investors feel less need for safety, they sell government bonds. And when Treasury prices fall, their yields rise.

The 10-year Treasury yield climbed to 1.94% from 1.92% late Thursday and from a low of 1.50% just last month.

Not only are yields on the rise, so is the gap between short- and long-term Treasurys. That’s seen as a vote of confidence in the economy by the bond market, and it means a closely followed warning bell about recession has turned silent.

The 10-year Treasury yield dropped below the two-year yield in late August and early September.