While figures can vary, a bear market occurs when prices fall 20 percent or more from a previous high for at least two months across multiple broad market indexes, such as the Dow Jones Industrial Average (DJIA) and the Standard & Poor’s 500 Index (S&P 500). On average, bear markets show up every three and a half years, which means a long-term investor must contend with at least a few bear markets over the years. Accordingly, if you’re invested in the markets, it’s important to figure out how to navigate those inevitable bear markets and lower the risk of devastating losses.

Bulls and Bears

Since 1926, the average bull market period has lasted nine years, with an average cumulative total return of 474 percent. The average bear market period, on the other hand, has lasted 1.4 years, with an average cumulative loss of -41 percent. (These figures are based on the historical performance of the S&P 500 Index from 1926 through March 2018). The most famous bear market in history—which began shortly before the stock market crash of October 1929—lasted 2.8 years. The S&P 500 fell an astonishing 86 percent and, while it started to recover in the second half of 1932, it did not revisit its previous peak until 1954—25 years after the crash.

Ride Out—or Get Out?

The widely accepted rule of thumb is that it’s always better to ride out market fluctuations than jump ship—after all, history shows us that prices will recover eventually. Keep in mind that by selling during a downturn, you guarantee your losses. In general, people who sell their investments at the bottom of a bear market tend to lose a lot of money, while those who hold on typically claw their way back into the black.

Still, there’s no guarantee that the next bear market will be followed by a swift recovery (the S&P 500 and the DJIA took 25 years to return to pre-Great Depression levels), plus it can be just about impossible for some investors to stand by and watch their portfolios tumble. So how can investors protect themselves when the market heads south? (Remember, it’s not a matter of if the market will take a downturn; it’s a matter of when.)

The Best Defense

Having your money tied up in one very risky stock—for example, one that’s extremely overvalued, has weak fundamentals and/or the company is operating under poor leadership—is not a good position to be in when the bears come knocking. In truth, it’s really not a good position under any market conditions.

To prepare for the next bear market, review your asset allocation to make sure you have the right mix of stocks, bonds and cash-type investments for your risk tolerance. Do some math to figure out how much your portfolio would lose if the market went down, say, 30 percent (a rough estimate). If it’s more than you’re comfortable losing, you’re too heavy in stocks. If you could withstand more risk, you may be too light in stocks. Either way, it’s time to tweak that portfolio.

Next, take a close look at the types of stock you own. A bear market is not a good time to be weighed down with small companies and speculative stocks. With a bear market on the horizon, your focus should be on high-quality, dividend-paying blue chips, with low levels of debt and strong profit margins—for your stock and stock fund positions.

Of course, no one knows exactly when the next bear market will be. Depending on your risk tolerance and time horizon, you may decide to maintain a bear-ready portfolio all the time or reallocate only when a bear market is looming. Either way, if you own stocks, you’ll probably suffer some damage during a bear market. The goal, however, is to minimize that damage so you’ll be in a good position to ride it out and take advantage of the next bull market.