TORONTO -- Canada's main stock index ended a two-day skid as a flash of optimism on trade lifted oil prices, but not enough to prevent the worst week for crude this year.

The July crude contract was up 72 cents at US$58.63 per barrel Friday but was still down 6.8 per cent for the week.

Despite the decrease, crude prices have risen 29 per cent so far this year.

The price of oil and stock markets overall rose Friday after U.S. President Donald Trump predicted a quick end to the trade dispute with China and suggested Huawei Technologies could be part of an agreement.

Markets have been fluctuating wildly with every presidential tweet or uttering, said Allan Small, senior investment adviser at HollisWealth.

"When you hear something from the president saying that maybe a deal can happen, that tends to bring on some positive feeling with investors and they started buying and have held on to those gains throughout the day," he said in an interview.

Markets have moved with Trump's comments ranging from threatening to blacklist Chinese tech firms, to raising tariffs on imports, and to offering a grace period on U.S. firms selling to Huawei.

"It's quite unnerving sometimes," Small added. "It's almost like you think that the president can control markets just by making a comment or sending out a tweet. He can take the markets down or up, whichever way he feels."

Markets rebounded despite data showing that U.S. durable goods orders fell more than expected in April, a day after U.S. manufacturing output fell to a nine-year low in May and the IHS Markit survey of service-oriented companies slipped to a 39-month low.

"So trade right now trumps everything. Today the news on trade was a little bit positive. We'll take it, markets are higher."

The S&P/TSX composite index closed up 65.43 points to 16,230.04, but still ended the week down one per cent.

The Canadian market's rise Friday was driven by gains in eight of the 11 major sectors.

The heavyweight financials sector was up 0.78 per cent as several banks saw their shares increase, led by the Bank of Montreal, after comments from TD Group and Royal Bank during quarterly results this week alleviated concerns stoked by CIBC about the state of their Canadian operations.

Health care, materials and energy were also higher. TransCanada Corp, Enbridge Inc. and Suncor Energy Inc. were all up.

The July natural gas contract rose 1.9 cents at US$2.61 per mmBTU.

The June gold contract was down US$1.80 at US$1,283.60 an ounce and the July copper contract was up 1.9 cents at US$2.70 a pound.

In New York, the Dow Jones industrial average was up 95.22 points at 25,585.69. The S&P 500 index was up 3.82 points at 2,826.06, while the Nasdaq composite was up 8.73 points at 7,637.01.

The Canadian dollar traded at an average of 74.37 cents US compared with an average of 74.19 cents US on Thursday.

Companies in this story: (TSX:BMO, TSX:TD, TSX:RY, TSX:CM, TSX:TRP, TSX:ENB, TSX:SU, TSX:GSPTSE, TSX:CADUSX)