The median forecast from the poll of 25 portfolio managers and strategists was for the Toronto S&P/TSX composite index <.GSPTSE> to rise 2 percent to 15,650 by the end of 2017 from Wednesday's close of 15,355.58.

Further gains are expected to lift the index, which posted a record high of 15,943.09 in February, to 16,000 by the middle of 2018 and to 16,450 by the end of next year.

"We expect choppy but upward trending equity markets in the latter half of 2017 based on reasonable economic growth and improving corporate earnings both in Canada and the U.S.," said Arthur Salzer, chief executive officer of Northland Wealth Management.

After rising 17.5 percent in 2016, the TSX has underperformed many other major markets this year, pressured by a drop in the price of oil, one of Canada's major exports, and investor worries that a slowdown in the housing market could hurt bank earnings.

Energy stocks account for nearly 20 percent of the TSX's weighting and have fallen around 22 percent this year, while financials - which have an even heavier weighting at more than one-third - is barely higher.

"We think that the drop in oil prices and fears about the Canadian financial sector are overdone," said Mathieu D'Anjou, senior economist at Desjardins Securities. "This opens the door to a better performance of the Canadian stocks market in the coming quarters."

Last week, Warren Buffett's Berkshire Hathaway Inc (>> Berkshire Hathaway) said it is providing a C$2 billion loan to Home Capital Group Inc (>> Home Capital Group Inc) and taking a 38 percent stake in the mortgage lender, which nearly collapsed in April. The move pressured short sellers who targeted the stock as Canada's housing market turned riskier.

The robust housing market helped Canada's economy grow an annualized 3.7 percent in the first quarter of 2017 following a strong expansion in the second half of 2016.

The strengthening of the domestic economy has prompted the Bank of Canada to signal higher interest rates lie ahead.

Canada, which sends about 75 percent of its exports to the United States, could also benefit if the policies of U.S. President Donald Trump boost economic growth.

"Fundamentals should help drive market returns going forward," said Ben Jang, portfolio manager at Nicola Wealth Management. "Weaker crude prices may dampen Canadian returns but a pickup in manufacturing in the U.S. will help bring up Canada."

Still, recent flattening of yield curves in the United States and Canada could weigh on the market if it signals to investors a recession looms, according to analysts polled in the past week.

Investors who expect the Federal Reserve to start reducing the size of its balance sheet near the end of 2017 and raise interest rates further may decide to "pull money off the table," said Colin Cieszynski, senior market analyst at CMC Markets Canada.

Other potential headwinds investors see are an unexpected slowdown in China that pressures commodity prices and the start, as early as mid-August, of renegotiation of the North American Free Trade Agreement.

It will "put the trade file front and center," Cieszynski said.

(For other stories from the Reuters global stock markets poll)

(Editing by W Simon)

By Fergal Smith

Stocks treated in this article : Berkshire Hathaway, Home Capital Group Inc