The past year has been rough for most people, and it's easy to feel pessimistic about the future. A whopping 83% of U.S. adults say they're feeling stressed about inflation, according to a 2022 survey from the American Psychological Association. And with many people worried about an impending recession, it's possible things could get worse before they get better.

However, there is a light at the end of the tunnel. A bull market is on the way, and legendary investor Warren Buffett can offer some smart advice about how to handle your investments right now.

1. Don't get hung up on short-term market movements

When the market is rocky, it's easy to focus on all the short-term ups and downs. But what really matters is the long-term performance.

Timing the market effectively is next to impossible, so nobody can say for certain when this bear market will end and the next bull market will begin. But we do know that no downturn lasts forever, so it's only a matter of time before the market rebounds.

^SPX Chart

^SPX data by YCharts.

In 2008, at the height of the Great Recession, Warren Buffett wrote an opinion piece for The New York Times. He wrote:

I can't predict the short-term movements of the stock market. I haven't the faintest idea as to whether stocks will be higher or lower a month or a year from now. What is likely, however, is that the market will move higher, perhaps substantially so, well before either sentiment or the economy turns up. So if you wait for the robins, spring will be over.

It's not easy watching your portfolio drop in value. But in times like these, it's more important than ever to keep a long-term outlook. The market will recover eventually, and the best thing you can do right now is ride out the storm.

2. Keep investing during the slumps

Stock market downturns may not seem like the best time to invest, but they can actually be a fantastic buying opportunity. When the market is in a slump, stock prices are lower -- sometimes substantially so.

Many stocks have watched their prices drop by 50% or more over the past year, which means now is your chance to load up on quality investments at a steep discount. Then when the market recovers, you could see lucrative earnings.

This strategy is one of the most effective ways to build wealth in the stock market and is also a Buffett-approved approach. As he wrote in the Times article.

A simple rule dictates my buying: Be fearful when others are greedy, and be greedy when others are fearful. To be sure, investors are right to be wary of highly leveraged entities or businesses in weak competitive positions. But fears regarding the long-term prosperity of the nation's many sound companies make no sense. These businesses will indeed suffer earnings hiccups, as they always have. But most major companies will be setting new profit records 5, 10 and 20 years from now.

3. Focus on quality companies

Keeping a long-term outlook and investing during the market's low points are two important steps to building wealth, but the third part of the equation is arguably the most important: Invest in the right stocks.

The investments you choose will make or break your portfolio. Shaky stocks will have a tougher time recovering from market downturns, and there's a greater risk you'll lose money. But strong stocks from healthy companies are far more likely to rebound.

In Berkshire Hathaway's 2021 letter to shareholders, Buffett emphasized that he and business partner Charlie Munger focus heavily on investing in quality companies. "[W]e own stocks based upon our expectations about their long-term business performance and not because we view them as vehicles for timely market moves," he writes. "That point is crucial: Charlie and I are not stock-pickers; we are business-pickers."

Right now is not an easy time to be an investor, but that doesn't mean it's a bad time to invest. By choosing quality investments, continuing to invest during the market's slumps, and holding those stocks for the long term, you can not only survive this downturn but generate wealth that lasts a lifetime.