U.S. stocks ended roughly flat Wednesday as a late bout of selling offset a modest rebound after President Trump voiced optimism that a deal with China is possible as early as this week.

American and Chinese officials are set to resume trade negotiations in Washington Thursday.

“China has just informed us that they (Vice-Premier) are now coming to the US to make a deal,” Trump tweeted Wednesday morning. He added, though, “We’ll see, but I am very happy with over $100 Billion a year in Tariffs filling U.S. coffers.”

That tweet followed earlier ones over the weekend that threatened China with tariffs, and sent stocks sinking Monday and Tuesday.

Stocks were highly volatile through the early afternoon on Wednesday as investors struggled to separate presidential bluster from the reality of bridging the gulf between the two countries. The Dow Jones industrial average swung from gains to losses before rising by more than 100 points, but those gains were narrowed by late morning and pared further in the late afternoon. The Dow closed up 2.24 points at 25,967.

The Standard & Poor’s 500 index rose 4.63 points, or 0.16%, at 2,879 , and the tech-heavy Nasdaq closed up 20 points, or 0.26%, to 7,943.

The blue-chip index tumbled more than 550 points over Monday and Tuesday after Trump threatened to increase tariffs on $200 billion in Chinese imports from 10% to 25% on Friday. White House officials confirmed that plan early this week, accusing China of reneging on previous commitments to resolve the dispute.

Jason Draho, head of Americas asset allocation at UBS Global Wealth Management, thinks edgy investors don’t necessarily need to see a deal happen this week and are resigned to the possibility of a higher duty taking effect Friday

Tariffs threatened:Trump's threatened tariff hike to 25% on Chinese goods would hurt consumers, the economy

Retirement goalpost:How much retirement savings will you need? Try 16.4 times your salary

“I think investors are looking through an increase in tariffs as a temporary measure as long as there’s significant negotiations and progress,” he says.

But he says markets are likely to continue to be volatile over the coming weeks as news on the talks continues to dribble out.

Investors “are going to react to both good news and bad news,” he says.

Ultimately, Draho believes an agreement will be reached, bolstering stocks. "The cost of having this escalate is too high for both countries," he says.