Many investors lost money in the stock market last year, and the losses were undoubtedly substantial in some cases. Recession fears stemming from high inflation and rising interest rates dragged the Dow Jones Industrial Average, the S&P 500, and Nasdaq Composite into a bear market in 2022, and all three indexes produced their worst returns since the global financial crisis in 2008.

Fortunately, every past bear market has ended in a new bull market, and there is no reason to expect a different outcome this time. That means the next bull market is already on its way. To prepare, follow the example set by Warren Buffett and other smart investors.

An investor points to a bar chart displayed on a tablet.

Image source: Getty Images.

Berkshire Hathaway is buying stocks

Warren Buffett has often advised investors to "be greedy when others are fearful" because widespread fear serves up bargain purchases. Now is the time to take action on those words.

The financial world is currently rife with fear. Inflation and rising interest rates have already taken a toll on the economy, consumer spending is on the decline, and many stalwart companies reported a drop in profits last year. But the Federal Reserve plans to push interest rates even higher in the coming months, and that could easily tip the economy into a full-blown recession.

That possibility has set off alarm bells on Wall Street, and panicked investors have sold stocks hand over fist. But Buffet measures the market in years and decades, not days and weeks. He knows the economy will eventually regain its momentum and, when that happens, the stock market will undoubtedly recover. In the meantime, panicked selling has left patient investors with a rare opportunity to buy good stocks at discounted prices, and Buffett has seized that opportunity.

In fact, Buffett-owned Berkshire Hathaway reported $66 billion in stock purchases through the first three quarters of 2022. That's more than the company invested during the previous three years combined.

Other smart investors have the same idea

The vast majority of professional investors underperform their benchmarks on a regular basis, but hedge fund manager Eric Bannasch of Cadian Capital Management has more than tripled the returns of the S&P 500 over the past three years. That makes him a smart investor by any standard. And like Buffett, Bannasch has been buying stocks throughout the bear market.

Last year, Bannasch started a position in HubSpot (HUBS 0.28%) and upped his stake in Alphabet (GOOG 0.68%) (GOOGL 0.56%). Those holdings now account for 19% of his portfolio, and there is a common thread between them. HubSpot and Alphabet have strong competitive positions in growing markets, and both stocks currently trade at discounts to their historical valuations.

HubSpot: This company is the leader in customer relationship management (CRM) software for small businesses, and it was recently named the best global software seller (in any category) by research company G2. That commendation reflects its strong market presence and high user satisfaction scores, and those qualities should keep HubSpot on the leading edge of the CRM industry for years to come.

That puts the company in front of a large and growing opportunity. The CRM software market is expected to increase at 14% annually through 2030. Yet, shares of HubSpot trade at 10.7 times sales, a bargain compared to the three-year average of 17.1 times sales. That creates an attractive buying opportunity for long-term investors.

Alphabet: This company is the market leader in digital advertising, capturing about $0.28 for every $1 in digital ad spend worldwide. That dominance stems in large part from the popularity of two web properties: Google has an effective monopoly in internet search, and YouTube is the most-watched streaming service in terms of viewing time. Additionally, Google Cloud is gaining market share in cloud computing, and research company Gartner says its product capabilities are improving faster than any other cloud vendor.

That leaves Alphabet well positioned to grow its business in the coming years. Global digital ad spend is forecasted to increase at 9% annually through 2030, and cloud spend is expected to increase at 14% annually over the same period.

Currently, shares of Alphabet trade at 4.3 times sales, a discount to the three-year average of 6.5 times sales. At that price, investors should consider buying a position in this stock.

Another way to prepare for the next bull market

Buying individual stocks requires homework. Investors need to research a company before buying shares, and they need to stay informed afterwards. Some people would prefer to spend their time in other ways. That's OK!

In fact, Buffett has often said an S&P 500 index fund is the most sensible strategy for most investors to gain exposure to the stock market. He explained his investment thesis in Berkshire's 2016 letter to shareholders, saying, "American business -- and consequently a basket of stocks -- is virtually certain to be worth far more in the years ahead." An S&P 500 index fund is a basket of stocks that tracks 500 large-cap U.S. companies, meaning it allows investors to spread their wealth across a diversified blend of blue chip American businesses.