As stock prices continue to sink, many investors are concerned about what that means for their portfolios.

The S&P 500 and the Nasdaq are officially in bear market territory after falling more than 20% from their peaks earlier this year, and nobody knows how long it will take for the market to recover.

Is it still worth it, then, to continue investing right now? And is it possible to make money even when we're in a bear market? It depends on your strategy.

Bear figuring with a stock market chart in the background.

Image source: Getty Images.

How not to invest during a bear market

During periods of volatility, it can be tempting to try to time the market -- or buy only when prices are at their lowest and sell when they reach their peaks.

In theory, this strategy makes sense. By investing when the market is at rock bottom, you can take advantage of those lower prices. Then when stock prices rebound, you can sell your investments for a hefty profit.

However, timing the market successfully is incredibly difficult, and it relies more on luck than skill in most cases. The stock market is unpredictable, and even the experts don't know exactly when prices will bottom out or how high they will get. If you buy or sell at the wrong moment, it could be costly.

Also, short-term investing outlooks can be riskier. Stocks that have the potential for short-term gains aren't always the healthiest investments overall, and there's a chance they may not recover from a market downturn. If you put a lot of money into short-term investments in the hopes of making a quick buck, you could lose more than you gain if those stocks fail.

A safer way to make money during periods of volatility

The good news is that it is possible to make money during a bear market, and it's easier than you might think. The key is to invest in strong companies and hold those stocks for the long term --regardless of what the market is doing.

Strong stocks from healthy companies are far more likely to recover from periods of volatility. That means no matter how far stock prices fall, you can rest easier knowing your investments have a good chance of bouncing back when the market inevitably recovers.

By holding your stocks for the long term, it also won't matter how many ups and downs the market experiences on its road to recovery. You don't need to predict how stock prices will fluctuate like you would if you were timing the market, because all that matters is that your investments see positive returns over time.

Historically, the market has seen positive long-term returns. In fact, in the last two decades alone, the S&P 500 is up more than 150%. That's despite several major downturns, including the dot-com meltdown, the Great Recession, the COVID-19 crash in 2020, and the current slump.

^SPX Chart

^SPX data by YCharts

While nobody knows exactly how the market will perform in the coming weeks or months, we do know that over the long run, it will experience positive average returns.

There are never any guarantees when it comes to the stock market. But by investing in quality stocks and holding your investments for the long term, it's far more likely you'll generate wealth despite all of the ups and downs along the way.