How much has President Donald Trump’s meandering trade war with China, Canada, Mexico and — well, everyone — cost you? If you’re an investor in the Standard & Poor’s 500, about 6% of your money, according to a new analysis by Bank of America Merrill Lynch.

Or, to put it in terms that all the newly minted “401k millionaires” we all wrote about last spring will understand, about $60,000 if you’ve got a million put away for retirement.

So much for trade wars being good and easy to win.

“It explains about half of the move in the market,” since the S&P SPX, -2.37% , the Dow Jones Industrials DJIA, -1.92% and other averages peaked earlier this year,“ Merrill economist Aditya Bhave said.

Merrill put the number together in advance of its annual forecasting conference. Its method was simple: Researchers looked at every day the market moved 0.5% or more, in either direction, and relied on that day’s Bloomberg News accounts of why the move happened.

Through Tuesday, that was a negative 6% on trade news this year. The positive impact from macroeconomic factors, which includes the tax cut Trump signed last December after Senate Majority Leader Mitch McConnell shepherded it through Congress, added 1.6% to the market this year, Bhave said.

The economic impact of trade has actually been fading in recent months, in large part because news from the housing market has been weakening, rattling stock investors, as interest rates rise, Bhave added.

Ethan Harris, Merrill’s chief global economist, said the tax bill initially caused a surge in business confidence and expectations that some of the money would be poured into investment — which was more bullish than competing views that corporations would spend most of their windfall on stock buybacks — but that optimism has faded as the president moved on to the second phase of his agenda, which is restricting trade in an effort to either open more export markets for U.S. producers or convince global companies to manufacture more in the U.S.

“It looks like about half of that [optimism] has been reversed by the trade wars,” Harris said. “That kind of nipped it in the bud.’’

And so it goes with the market’s Trump Two-Step: It likes the tax cut and has a certain affection for deregulation in the financial sector that makes many Democrats queasy (fearing a return to conditions that created the 2008 financial crisis), but thinks the trade war is bad for exports and growth.

That view certainly got another boost from Thursday’s numbers on trade, which show both imports and exports slowing as hostilities with China rise, even as Trump signed a revised version of the North American Free Trade Agreement with Canada and Mexico at last week’s G-20 Summit in Argentina.

But the trade war hasn’t worked much into the broader economy yet, and by Merrill’s forecast at least the trade wars aren’t a threat to the expansion any time soon. Merrill thinks unemployment will hit 3.2% by late next year, and wage growth will pick up slightly to 3.5% year-over-year, without sparking much inflation.

That’s a pretty Goldilocks view, within the range of the reports now coming out on Wall Street but more optimistic than the forecast of an early 2020 recession from Grant Thornton’s Diane Swonk that’s getting a lot of attention right now. But next year’s growth will be front-loaded in the first half of the year, Bhave said in a follow-up interview after the forecast call.

“The growth rate will still be above trend, but the fiscal [stimulus] impact will be fading,’’ Bhave said, pointing at both the tax cut and the budget deal that temporarily increased spending late last year.

One reason Merrill is more optimistic is that its economists think that Trump and China will work out a deal sometime next year that averts the market’s worst fears and ends the recent roller-coaster ride based on what the president says (or tweets) on any particular day.

We may look back on this moment as the hardest part, Harris said, because negotiating positions in public tend to reach their hardest point just before real negotiations begin.

“For markets, it’s not going to be quick,’’ he said. “It’s going to take months.”

But investors who want to know what the president’s shenanigans have been costing them now have an answer. Not a definitive answer, but a working number.

And for an upper-middle-class investor with $1 million in a 401k, that number is $60,000. Double that, or cut it in half, depending on the size of your own nest egg.

Was your tax cut bigger than that?