The recent economic picture in Canada can hardly be called rosy.

The country lost more than 31,000 jobs last month, our trade deficit is at a record high, the most recent monthly reading of GDP was the weakest in seven years and oil prices — so vital to Canada's energy sector — are well off their highs. Everyone from the Bank of Canada to the Conference Board to the IMF has been busy ratcheting down their growth predictions for the Canadian economy.

Despite all that gloomy news, the benchmark index of the Toronto Stock Exchange sits today at its highest level in more than a year — its fifth gain in a row — and is within spitting distance of its all-time high.

So what's the deal?

We talked to market analysts to find out why this seeming disconnect exists.

A question of weight

"This year in particular, the gold sector has done really well," says Allan Small, a senior investment adviser at the Allan Small Financial Group with HollisWealth.

That's significant, because gold, as it turns out, has a weighting in the S&P/TSX market index that far outweighs its importance to the economy at large. Gold mining companies are the biggest drivers of the materials sector, which accounts for 14 per cent of the TSX.

So when the gold sector does well — and it has more than doubled since the start of this year — that really helps to boost the whole TSX index.

In fact, recent strength in gold and other extracted commodities has given Canada the second-best-performing developed market in the world this year, according to Bloomberg data, trailing only New Zealand.

Gold's weighting in the TSX stock market is just one example of how the economy bears little resemblance to the stock market. But it's not the only one.

Oil and gas stocks account for up to a quarter of the main TSX index. While energy is an important part of the Canadian economy, it doesn't account for a quarter of it.

Ian Nakamoto, chief market strategist at 3Macs in Toronto, puts it simply: "The Canadian stock market is just not representative of the Canadian economy."

The U.S. effect

Last Friday, Canada and the U.S. both released employment figures. The U.S. economy churned out 255,000 jobs in July, far above what economists were expecting. The Canadian economy, on the other hand, disappointed with an unexpected jobs decline.

Yet stock markets in both the U.S. and Canada staged big gains.

"Because we are so tied to the U.S., we piggy-back on top of their data," Small says, noting that Canada exports a lot of what we make and pull out of the ground.

So if the U.S. economy is doing relatively well, stocks here that have significant exposure to the U.S. market will tend to benefit.

"The U.S. is the largest economy in the world," notes 3Macs' Nakamoto. "So there's a sense, if they're doing well, it will spill over to other economies."

The 'TINA' effect

Low interest rates aren't just driving housing prices higher. They're helping to boost the stock market.

Market watchers call it TINA. That's short for "there is no alternative."

Interest rates are so low these days that people looking for a meaningful return on their money have little alternative to equities. Bond yields are low, GICs give poor returns and bank accounts pay virtually nothing on savings.

"Traditional investors are almost being forced to go into the market to get a rate of return that is greater than the inflation rate," says HollisWealth's Small. "People just don't have another option."

So people who are looking for meaningful returns and can handle a bit of risk are chasing the types of stocks that pay annual dividends of three or even four per cent — like banks, utilities and telecoms.

The influx of all that yield-seeking money also helps to bid up the price of those dividend-paying stocks, which in turn helps to boost the overall TSX market's value.

The outlook

Despite the comparatively lofty levels of Canadian stocks, both analysts say the market still offers some places to invest.

"I think that those companies that have dividend yields of three per cent or better, and have a history of increasing their dividends, will do well," says Nakamoto.

Small also says he's not shying away from the stock market, but says "it is becoming more difficult to find the diamonds in the rough."

He notes that every time there's been a significant pullback — such as when the U.K. voted to leave the EU in June — the market has quickly bounced back.

"I do have cash positions in my portfolios right now," he says, ready to pounce on any opportunities pullbacks offer.

"That's the environment we're in right now."