It's officially a bull market: The S&P 500 closed at a new record high last Friday, roughly two years after its previous peak. The broad market index has gained about 33% since the low point of the last bear market on Oct. 12, 2022.

With the stock market reaching uncharted territory, it's only natural to wonder what the new record means for stocks. Is now a good time to put money in the market, or is there a chance of a pullback?

Let's take a look at what the record shows.

A silhouette of a bull on a mountainside.

Image source: Getty Images.

The S&P 500's peaks and valleys

Since 1950, the S&P 500 has had 11 bear markets, which are defined as a decline of 20% or more from the market's peak to its trough. The duration of those peak-to-trough declines ranged from just 33 days, when the coronavirus pandemic began, to nearly 2.5 years, after the dot-com bubble burst.

However, what we want to know is how long a typical bull market lasts after the first post-bear-market all-time high is reached. Since 1950, that period has been as short as four months, which happened twice. The first was in 1980, when a long rebound from the oil crisis that lasted from 1974 to 1980 gave way to the "Volcker recession," as stocks crashed when Fed Chair Paul Volcker hiked interest rates to tame inflation. In 2007, there was a similarly short period from a new all-time high to the next peak, as the bull market that came out of the dot-com bust ran into the global financial crisis.

On the other end of the spectrum, the longest period between a new all-time high and the next peak was from the post-Black-Monday recovery, which set an all-time high in July 1989, to the end of the dot-com boom in March 2000, or a period of nearly 11 years.

On average, the duration of the period from the new all-time high to the next peak was 3.3 years since the 10 times that event happened since 1950.

Will this time be different?

Based on this information, there doesn't seem to be much of a historical pattern between hitting a new all-time high and how long the new bull market will last, as it's ranged from just four months to nearly 11 years.

However, what's worth noting is that the next bear market has historically been caused by a new event or a new economic cycle. In 2007, that was the financial crisis. In 1980, it was the Volcker recession. And in 1973, it was the oil crisis. Other triggers include the dot-com bust and the coronavirus pandemic.

This stock market cycle is different from those in the past because most bear markets come along with a recession. While many economists and CEOs predicted a recession back in 2022 and 2023, one hasn't materialized, even as the benchmark federal funds rate has jumped to more than 5%. With the S&P 500 back at all-time highs, investors seem to be more confident than before that we will get the so-called "soft landing," meaning the Fed will be able to bring inflation down to its goal of 2% without causing a recession.

What it means for investors

While it can be useful to look at history for lessons on the stock market, there are rarely easy answers or repeatable patterns, and history shows that a new all-time high isn't a guarantee of a lasting bull market, though the average one has gone for more than three years.

The good news for investors right now is that there doesn't seem to be a major threat to the economy on the horizon, but that could change faster than you think. Most market disruptions start out as unseen threats, after all.

Rather than trying to time the market based on new milestones, however, investors are better off buying high-quality stocks and sticking with them over the long term. With that strategy, you'll benefit from the magic of compounding and from the S&P 500's long-term track record of returning 9% or more a year -- from bull to bear and back again.