The index had hit a one-week low earlier in the session, as China’s weak trade data and the prospects of a Federal Reserve interest rate hike by the end of the year weighed on global markets.

Gold miners were also among the most influential gainers, as gold edged higher on the broader economic worries. Goldcorp Inc climbed 1.8 percent to C$19.39 and Barrick Gold Corp advanced 0.6 percent to C$21.15.

Toronto Stock Exchange’s S&P/TSX composite index closed up 24.74 points, or 0.17 percent, at 14,643.71. It earlier touched its lowest since Oct. 4 at 14,472.78. Six of its 10 main groups rose.

The energy group gained 0.6 percent, with shares of Suncor Energy Inc up 1.1 percent to C$37.59. The financial sector added 0.2 percent, with Royal Bank of Canada up 0.6 percent at C$82.61.

Barry Schwartz, a portfolio manager at Baskin Financial Services, said he was avoiding gold stocks and skeptical of valuations in the energy sector, but that stocks tied to housing had been unduly punished after recent government moves to cool hot markets.

“Some of these oil stocks are trading as if oil’s guaranteed to go back to $100 a barrel. I‘m not so sure,” he said. “The whole financial sector is still trading as if Canada’s going down the sinkhole. It’s not happening.”

Canadian resale home prices rose in September from a month earlier while new home prices were up in August, separate reports showed on Thursday, suggesting that slowing sales in some regions have not yet cooled prices.

Both Brent and U.S. crude oil prices settled up above $50 a barrel after a U.S. government report showing hefty draws in diesel and gasoline offset the first crude inventory build in six weeks.

Amaya Inc shares fell 6.2 percent to C$21.50 after a leading investor in William Hill said it would oppose any reverse takeover of the Canadian online gambling company.

Teck Resources Ltd fell 3.3 percent to C$23.92 after having reached its highest in more than two years on Wednesday. (Additional reporting by Fergal Smith; Editing by Will Dunham)