This year hasn't been easy for investors. Between surging inflation, a bear market, and the constant threat of a recession, it's easy to feel discouraged about the future.

But there is good news. Every single bear market and recession in history -- no matter how severe -- has eventually given way to a bull market. While nobody can predict exactly how long this market slump will last, we do know a bull market is on the way.

That may not be reassuring right now, while we're still in the thick of this downturn. But now is the time to start preparing for the inevitable upswing. Famed investor Warren Buffett knows a thing or two about taking advantage of a bull market, and this is his advice.

Warren Buffett speaking into a microphone.

Image source: The Motley Fool.

Why right now is the time to invest

When stock prices are down and many people are concerned about a potential recession, investing even more in the stock market may be the last thought on your mind. But to maximize your earnings, now is the time to buy.

Back in 2008, Warren Buffett penned an opinion piece for The New York Times. In it, he explained: "A simple rule dictates my buying: Be fearful when others are greedy, and be greedy when others are fearful."

Right now, stock prices across the board are lower than they've been in months. Some industries -- like the tech sector -- have been hit particularly hard. If you've been looking for a chance to load up on quality stocks at a steep discount, now is the time to "be greedy."

How to maximize your earnings

Investing now doesn't only allow you to take advantage of lower prices. When the market inevitably rebounds, you could see enormous gains.

For example, say you had invested in Amazon in March 2009 -- when it was at its lowest point during the Great Recession. In the following year alone, you would have seen returns of around 113%. Over five years, you'd have seen gains of nearly 560%.

AMZN Chart

AMZN data by YCharts

If you only invest during the high points, it's harder to take advantage of a bull market's upswing. But by investing when the market is at its lowest, you can set yourself up for significant gains.

When will the market recover?

One of the hardest parts of investing during a downturn is that nobody knows exactly how long it will take for the market to recover. But it will rebound eventually. And if you wait too long to invest, you could miss out on some of those gains.

"Let me be clear on one point: I can't predict the short-term movements of the stock market," Buffett says in the Times piece. "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."

While it may not seem like it, now is one of the best investing opportunities of the year. Stocks are more affordable than they've been in a long time. If you can swing it, investing now can help you take advantage of the inevitable bull market.