As all three major indexes touched bear territory last year, many investors hesitated to buy stocks. Rising inflation and general economic woes added to their concerns. And now, there's another element that may reinforce the worries. The Federal Reserve forecasts a recession just ahead.

Minutes from a recent Federal Open Markets Committee (FOMC) meeting predict a "mild recession" later in the year. History shows us that recessions haven't been the easiest of times for investors. So, it's very logical to ask the question you may have been asking since the start of this wave of economic troubles: Should I buy stocks right now? Let's find out.

The Fed comments

First, a bit more detail about the FOMC prediction. The body that defines U.S. monetary policy said gross domestic product growth forecasts for this year have been "subdued" for a while and some weakness in the labor market had been expected too. The addition of the recent banking-sector turmoil, though, aggravated the situation -- leading officials to predict a recession.

The good news is, as mentioned above, the expectation is for a slight downturn -- and the Fed expects recovery to begin next year. Research from International Monetary Fund economists shows recoveries tend to be strong -- and periods of expansion last longer than recessions. All of this is encouraging -- and helps us remember these difficult situations are temporary.

Now let's get back to our question: Even though these tough times won't last forever, should you really buy stocks at this point? After all, the indexes may not have reached a bottom.

It's true that, as a whole, the market may fall further. But that wouldn't stop me from buying stocks today. For a couple of reasons. First, it's impossible to time the general market or a particular stock -- and get in on the absolute lowest price. But over time, this won't matter.

Major indexes have returned to their pre-recession levels following past recessions and gone on to gain. This means even if you bought an index tracker, if you held on for the long term, you benefited from your investment.

And the same holds true if you bought individual stocks. Let's look at a handful of top consumer goods and healthcare names: Amazon (AMZN -0.34%), Coca-Cola (KO 0.15%), Pfizer (PFE 0.88%), and Abbott Laboratories (ABT 1.96%). All of these stocks suffered during the Great Recession -- from December 2007 through June 2009.

AMZN Chart

AMZN data by YCharts

But if you held on for five years from the start of the recession, you would have seen gains in each stock.

AMZN Chart

AMZN data by YCharts

By holding on through today, you really would have seen your portfolio grow.

AMZN Chart

AMZN data by YCharts

The importance of long term

This shows the importance of long-term investing and should lift some of your concerns about investing ahead of or during a recession.

It's also worth considering valuation. Many stocks today are trading at dirt cheap prices. Economic woes have spurred investors to turn their backs on companies most sensitive to the economy. But in many cases, these companies' long-term prospects remain very bright.

A good example is Home Depot (HD -0.74%). The stock has stagnated over the past year even after adding $40 billion to sales during the previous two years.

Even predicting flat sales this year, Home Depot still is a leader in a market set to perform over time. Today, Home Depot is trading for about 18 times trailing 12-month earnings -- compared to more than 25 in recent years.

All of this means, even with a possible recession ahead, you still can buy stocks now and win over the long haul. And buying now allows you to scoop up many quality companies for a song. That's a definite plus.

What's important when considering stocks today -- or at any time -- is focusing on the long term. That may help you stay positive during tough times -- and offer you the best path to potential wealth.