The Trump administration said it will impose a tariff averaging 20 percent on Canadian softwood lumber imports in retaliation for alleged improper subsidies.

Traders believe the action may initially cause lumber futures to jump, which in turn will weigh on shares of homebuilders when trading begins Tuesday. The type of lumber targeted by the tariff is used to build houses.

The Canadian loonie was already falling versus the U.S. dollar in overnight trading.

The action, the culmination of a long-running dispute between the two countries, wasn't totally unexpected as lumber futures have surged already this year in anticipation of a possible escalation of this sort by President Trump and his Commerce Secretary Wilbur Ross.

"I am surprised that the loonie is not getting hit harder," said Brian Kelly of BKCM LLC in an email. "The last time the U.S. imposed tariffs on Canadian lumber was in 2006. Canada responded by tripling its exports to China."

Lumber futures are up more than 20 percent this year as traders bet it may come to this.

Lumber CME, YTD:

"Lumber futures should move higher, but this announcement has been anticipated," Kelly added. We "might get a sell the news [event], in which case you want to buy any sell-off in homebuilders in the morning."

Short-term spikes have weighed on housing shares in the past. CNBC looked at how certain related securities performed when lumber futures spiked by 5 percent or more in a single day, something that's happened 39 times in the last decade, according to Kensho.

Here's what happens, on average, on those trading days:

The average losses from housing shares are small because often times, a jump in lumber prices is because of increasing housing demand.

But not this time. If homebuilders import their lumber from Canada, this will likely hit their bottom line directly.

The falling loonie may weigh on Canadian stocks if history is any guide. Here's what happened, on average, to the iShares MSCI Canada ETF when the currency lost 0.5 percent of its value or more versus the dollar:

Shares of lumber producers subject to the tariff, such as Canfor, may come under pressure in Canadian equity trading. U.S. timber-related stocks including Deltic Timber and Potlatch Corp. will also likely be active in Tuesday's session ahead.