This Chart Explains the Stock Market Rally Since November

Since the Nov. 8 election, the stock market has risen sharply. As of this writing, the S&P 500(SNPINDEX: ^GSPC) has sported a 10.8% run since the polls closed.

Image source: Getty Images.

We've heard many explanations for the run, including the new Trump administration's expected policy changes, Federal Reserve speeches that tout a solidU.S. economy, and a rebound in international optimism following the initial post-election fears.

Here's the most fundamental reason, though, that stocks have been rallying.

What happened in 2016

When we strip away the political and emotional bias, the news (which is often more negative than reality), and speculation on future events, all we're left with is math. And the math for the past few quarters has looked pretty good.

Fourth-quarter 2016 earnings are wrapping up, and so far the S&P 500 is posting a 4.6% year-over-year gain. That makes the second quarter in a row in which profits are up from last year and the third consecutive quarter in a row of rising profits for the nation's biggest companies.

Chart by author. Data source: Federal Reserve Bank of St. Louis.

In 2015, and through the first quarter of 2016, profits took a plunge because of several negative factors. Low oil and commodity prices hurt some companies, and wage and healthcare cost increases weighed on multiple industries.

As some of those factors started to ease through the past year, the way was paved for the stock market's run. The end of the election and the promise of looser regulations and lower taxes have certainly helped. But over the long term, growth in the bottom line is the most basic factor influencing the value of stocks.

The outlook for 2017

Consensus estimates are that profits will continue to rise this year, including in the first quarter, in which profits could surpass the big dip from the winter quarter a year ago. Analysts expect that full-year 2017 earnings will grow about 10% on the back of about 5.5% revenue growth for the S&P 500.

Leading the way with those estimates are the oil and materials sectors, which were beaten up the most when commodity prices tanked starting in 2014. After that, the financial sector is expected to see a 12.1% bump during the year. Rounding out the top five are technology and consumer discretionary, at a 7.3% and 5.7% rise, respectively.

Those positive estimates are the root of all reasons driving this rally. However, with that rally has come higher valuations. The average forward price-to-earnings ratio is now at 17.6, the highest since 2004. What should investors do now?

Time to go bargain hunting

Stock prices may be on the high side, but optimism isn'tnecessarilyunfounded here.As long as there's a positive outlook for profits on the horizon, that should provide a safety net for those companies' stocks. However, exercising a bit of caution is always wise.

Investors will want to hold on to some cash this year to buy up shares if there are any dips in the market or if the economy decides to second-guess itself. Also, just because the market has hit new records doesn't mean all companies are expensive.Scooping up stocks that haven't rallied but are still expecting profitable gains this year are still out there. For example, the retailer and restaurant sector, as measured by the SPDR S&P 500 Retail ETF (NYSEMKT: XRT), had a tough time in 2016 and failed to enjoy the broad-based run-up the overall market has had.

XRT data by YCharts.

Optimism is high, but it's important to remember how fickle the stock market is and how quickly things can change. At any rate, the one metric for investors to stay focused on is profitability and the future potential growth rate.

10 stocks we like better thanWal-MartWhen investing geniuses David and TomGardner have a stock tip, it can pay to listen. After all, the newsletter theyhave run for over a decade, the Motley Fool Stock Advisor, has tripled the market.*

David and Tomjust revealed what they believe are theten best stocksfor investors to buy right now... and Wal-Mart wasn't one of them! That's right -- theythink these 10 stocks are even better buys.

Click hereto learn about these picks!

*StockAdvisor returns as of December 12, 2016The author(s) may have a position in any stocks mentioned.

Nicholas Rossolillo has no position in any stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.