(Adds portfolio manager quotes and adds details; updates prices)
* TSX closes down 1.62 points, or 0.01 percent, at 15,256.35
* Just four of the TSX's 10 main groups end lower
* Index closes above 50-day moving average for 2nd straight day
By Fergal Smith
TORONTO, Aug 8 (Reuters) - Canada's main stock index ended nearly flat on Tuesday as resource and technology shares weighed, offsetting positive earnings results and a deal in the gaming sector.
The Toronto Stock Exchange's S&P/TSX composite index closed down 1.62 points, or 0.01 percent, at 15,256.35.
Stocks adjusted to what happened in U.S. markets on Monday, when Canada's market was closed (for a public holiday), said John Kinsey, portfolio manager at Caldwell Securities.
BlackBerry Ltd declined 4.5 percent to C$11.41 after Goldman Sachs resumed coverage of the company with a sell rating on Monday. Goldman Sachs said rising competition in enterprise mobility outweighed BlackBerry's automotive opportunities.
Software maker Open Text Corp fell 4.8 percent to C$41.55, while the overall technology group lost 1.6 percent.
The energy group fell 0.4 percent as oil prices declined. Enbridge Inc fell 1.6 percent to C$51.73 and TransCanada Corp lost 1.1 percent to C$63.44.
U.S. crude oil futures settled 22 cents lower at $49.17 a barrel as exports from key OPEC producers rose.
Pretium Resources Inc fell 8.7 percent to C$10.32 a share, while the overall materials group, which includes precious and base metals miners and fertilizer companies, slipped 0.1 percent.
Still, just four of the index's 10 main groups ended in negative territory and the index closed above its 50-day moving average for the second straight session, which could signal a shift to a bullish trend.
"I think the U.S. is aiding it," Kinsey said.
The Dow and the S&P 500 scaled new record highs intraday before closing lower after U.S. President Donald Trump warned he will counter North Korea with "fire and fury" if the country endangers the United States.
Valeant Pharmaceuticals International Inc gained 3.1 percent to C$19.74 after the company reported better-than-expected quarterly results and said it would hit its debt repayment target ahead of schedule.
Ritchie Bros Auctioneers rallied 8.0 percent to C$37.54 after it reported quarterly revenue that was better than forecast.
Great Canadian Gaming surged 18.0 percent to C$30.00 after it was announced that the casino operator and Brookfield Business Partners would acquire key Toronto area gaming assets and have exclusive rights to operate the assets for at least 22 years.
Brookfield Business shares rose 7.8 percent to C$38.05.
The industrials group, home to companies including Ritchie, and Brookfield Business, rose 0.4 percent. (Additional reporting by Solarina Ho; Editing by Paul Simao and Sandra Maler)