Positive signals from U.S.-China trade talks and rising oil prices helped Canada’s main stock index to reach a near four-week high on Tuesday.

Investors latched onto hope of a trade deal as markets have been fragile and lacked a solid direction in recent months, says Dominique Barker, portfolio manager at CIBC Asset Management.

“Things have been so battered that any inkling of good news is interpreted with enthusiasm and stock prices are reacting accordingly,” she said in an interview.

U.S. President Donald Trump gave investor sentiment a boost when he tweeted that talks with China were “going very well.”

The involvement of a senior Chinese official also buoyed expectations, said Barker.

But she warned about the impact of failure.

“If we get a poor outcome from the trade talks we could see the market down again, potentially even below those levels from four weeks ago.”

The S&P/TSX composite index closed up by 101.02 points to 14,605.15 after hitting 14,645.61, the highest level since Dec. 13, 2018.

The biggest gainers on the day were Nutrien Ltd., CGI Group Inc., Enbridge Inc., Canadian Pacific Railway Ltd. and Alimentation Couche-Tard. The weakest were Royal Bank of Canada, Sun Life Financial Inc., Brookfield Asset Management Inc., Telus Corp. and Thomson Reuters Corp.

All sectors save for health care were in positive territory, led by technology, utilities and consumer discretionary. The influential materials, industrials and financials sectors were in the middle of the pack.

The February gold contract was down by US$4 at US$1,285.90 an ounce and the March copper contract was up by US1.9¢ at US$2.66 a pound.

The key energy sector rose slightly as the February crude contract was up by US$1.26 at US$49.78 a barrel and the February natural gas contract was up by US2.3¢ at US$2.97 per mmBTU.

Oil prices rose for an eighth straight day on production cuts from OPEC, Russia and Alberta taking effect in the new year.

The Canadian dollar traded at an average of US75.23¢ compared with an average of US75.11¢ on Monday.

In New York, the Dow Jones industrial average gained 256.10 points to reach 23,787.45. The S&P 500 index rose by 24.72 points at 2,574.41, while the Nasdaq composite was up by 73.53 points at 6,897.00.

Trump’s prime-time speech Tuesday about border security could have repercussions on the market should he call for a national emergency, Barker said: “That would create a direction to the market, up or down, it depends on the outcome.”