"There is no better teacher than history in determining the future."

--Charlie Munger

The late, great Charlie Munger, who passed away last month at 99, knew a thing or two about history. In his lifetime, he lived through the Great Depression, the Second World War, and more than a dozen U.S. recessions. And that's just his own firsthand experience. As any history buff can tell you, by studying history, those in the present learn from those in the past -- and that gives you a leg up -- particularly when investing.

With that in mind, let's examine some recent stock market history and what it might mean for 2024.

Digital stock charts on a screen.

Image source: Getty Images.

Last month was one of the best Novembers on record for the S&P 500

With less than a month left in 2023, the stock market is on pace to turn in a banner year. The S&P 500, Nasdaq Composite, and Dow Jones Industrial Average are up 19%, 36%, and 9%, respectively. In part, that's thanks to stellar returns in November.

Take the S&P 500, the benchmark index. It notched an 8.9% gain in November. That marks only the fifth time the index has gained more than 8% in November, dating back to 1954.

Year November Return
1954 8.1%
1962 10.2%
1980 10.2%
2020 10.8%
2023 8.9%

Data source: Ycharts.

Each of the prior four Novembers (1954, 1962, 1980, and 2020) followed unique circumstances and events -- ranging from the aftermath of the Cuban Missile Crisis in 1962 to the elections of Ronald Reagan in 1980 and Joe Biden in 2020. Nevertheless, in all but one of the calendar years following these Novembers, the S&P 500 recorded a double-digit move higher.

In fact, in three of the four years (1955, 1963, and 2021), the S&P 500 gained 18% or more -- averaging a 24% return.

Year S&P 500 November Return Following Year S&P 500 Full-Year Return
1954 8.1% 1955 26.4%
1962 10.2% 1963 19.7%
1980 10.2% 1981 -9.7%
2020 10.8% 2021 26.9%
2023 8.9% 2024 not yet known

Data source: Ycharts.

True, in 1981, the index was down 10%. And if you include that year, the average return in the following calendar year drops from a 24% gain to a 16% gain.

But it should be remembered that 1981 was a historically bad year. Record-high inflation, sky-high interest rates, and double-digit unemployment rates led to one of the worst recessions since the Great Depression. As a result, the stock market tumbled.

In fact, 1981 was the only year in the entire decade of the 1980s when the S&P 500 posted an annual decline. Moreover, 1981 holds the record for the worst year on the stock market between 1978 and 1999 -- a span of 22 years. In short, 1981 was an outlier.

What does this mean for 2024?

Granted, this pattern represents a very small sample size, and investors shouldn't rely solely on past performance when making investment decisions. Furthermore, every investor should diversify, dollar-cost average, and hold for the long term. And in that respect, putting money in the stock market is good idea -- no matter the timing.

So, to sum up, last month was a record-setting November, and if the trend holds, 2024 could shape up to be an excellent year for stocks. Nevertheless, the best strategy is to always target long-term gains through a diversified portfolio.