The stars may be finally lining up for the S&P/TSX.

Since January 20, the TSX has rallied over 17%, which would mark the largest rally in such a short time frame in over seven years. Year-to-date returns are around 7% (not including dividends), and this already exceeds greatly the -8.3% (including dividends) the TSX saw in 2015.

The issue with a down year like 2015 is that it pulls investors out of the Canadian market. These investors will either hide in cash (a recent CIBC report found that Canadians have a record $75 billion in excess cash and that cash positions grew by 11% in 2015), or they will invest outside Canada by purchasing U.S. stocks or buying ETF or mutual fund products that give international exposure.

A CIBC poll found that 41% of Canadians are now looking for opportunities outside Canada compared to 31% last year. Unfortunately, these investors may be making a mistake, since many analysts expect the TSX to outperform the U.S. S&P 500 this year. Here’s why the TSX is likely to do well.

1. Improving energy prices

The TSX is heavily moved by oil prices. According to National Bank, the correlation between the TSX and WTI oil prices is at a long-term high of 0.75 (a high of one would mean they move together perfectly). While the correlation is not usually this high, it has been generally growing since 2004. If this correlation stays, a recovery in oil prices will mean more strength to the TSX.

It seems like a recovery in oil prices is currently in the cards. Not only does nearly every analyst see oil about to form some form of medium-term uptrend—starting either this year or next year depending on the analyst—but the market fundamentals are also pointing in this direction as well.

While there is currently an oversupply of about 1.5 million barrels per day, high-cost U.S. production is very steadily coming off the market with March production averaging around nine million barrels per day (and production has dropped below nine million barrels per day in April). This is down 660,000 barrels per day from a year ago, and 2016 could see 600,000-700,000 barrels coming offline.

This will inevitably lead to price increases, and the TSX will benefit.

2. The Canadian economy is firming up

Firstly, Canadian GDP growth, despite the pessimism, has been quite solid. January GDP grew by an impressive 0.6% (7.2% annualized). This was double expectations and is simply a continuation of past strength. Over the past three months, the Canadian economy has grown at an annualized rate of 5%, and economists are predicting a 3.5% growth rate for the first quarter, which would make it the strongest quarter in five years.

Most importantly, the strength in Canada is generally broad based, and exports in particular have been quite strong. Exports have growth in three of the past four months. In January, exports grew at the fastest pace since May 2014, and the export strength is a sign that the weak Canadian dollar is working.

These are optimistic signs for the Canadian economy, and the weak loonie and weakness from the energy sector are clearly starting a movement of resources to the non-commodity sector, which will be important to help rebalance the economy.

3. The TSX seems undervalued  

The TSX is currently trading at a forward P/E ratio of 16.35. The 10-year average trailing P/E is about 17.9, which means the TSX has quite a bit of room to move upwards. National Bank thinks 17.3 is a reasonable P/E, which would value the TSX at about 14,700 (or 5.7% above current levels).

How should investors take advantage? While energy names are one way, Canada’s banks should also benefit, specifically Bank of Nova Scotia (TSX:BNS)(NYSE:BNS) and Toronto-Dominion Bank (TSX:TD)(NYSE:TD).

Scotia is trading at a discount to the peer group due largely to its oil and emerging market exposure (which means more upside if oil prices and the TSX recover), and TD is generally seen as a best-in-class name with solid earning power.

Looking for more ways to benefit from the Canadian economy?

Exports of liquefied natural gas could be one of the best growth opportunities out there for long-term investors. And, we think we've identified the Canadian company to invest in. It's a global company with operations across nearly 20 countries and 70 locations. We like it so much, we've named it as 1 Top Stock for 2016 and Beyond. To find out why, click here now to learn how to access your FREE copy today!

NEW! This Stock Could Be Like Buying Amazon In 1997

For only the 5th time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO.

Stock Advisor Canada’s Chief Investment Adviser, Iain Butler, also recommended this company back in March – and it’s already up a whopping 57%!

Enter your email address below to claim your copy of this brand new report, “Breakthrough IPO Receives Rare Endorsement.”

Fool contributor Adam Mancini has no position in any stocks mentioned.