Two competing mentalities are at war within the minds of many investors. One is based on our natural tendency to want to avoid losses. With the S&P 500 again near bear market territory, the thought of buying stocks could be scary. The other is driven by the knowledge that, historically, buying stocks after the market has fallen significantly has often led to handsome returns over the long run.

Should you buy stocks right now? The answer to the question isn't as simple as going with the rational conclusion over the emotional one. In reality, the best answer is an old standby: It depends. But what should tip the balance in your decision about whether or not to buy stocks now? 

A person with a wary expression looking at a computer screen.

Image source: Getty Images.

Don't buy stocks if...

There is one group of people who absolutely, irrefutably should not buy stocks right now. This group shouldn't even give a moment's thought to it at this point -- people who don't have extra cash on hand that they don't need for anything else. Among your financial priorities, it's much more important to pay your bills and lower your debt. If doing those things properly would leave you with no spare money to invest ... don't invest. However, there are other folks -- people who actually have spare cash that they could invest -- who still shouldn't be buying stocks now.

If, for example, there's a good chance you might need to spend that extra money at some point over the next few years, it's better to find somewhere else to park it in the meantime. My view is that Series I savings bonds -- whose returns are linked to inflation rates -- could be a good option for many people given today's historically high inflation.

Even if the stock market was in a roaring bull market right now, I'd still recommend against people investing cash that they could need relatively soon. The stock market is too volatile over the short term and intermediate term to put this type of money at risk.

Exactly how long are "the next few years" and "relatively soon"? You'll get different answers to this question from different people. My take, though, is that any cash that you might need within the next seven years or so shouldn't be invested in stocks. 

Buy stocks if...

What types of investors should buy stocks right now? Everyone else not mentioned above.

But what if stocks fall even more? Wouldn't it be better to wait and see what happens? Admittedly, the market could continue to decline. But no one knows for sure if it will or it won't.

You might be able to time the market. If you do, though, it would be sheer luck. The more likely scenario, though, is that you would be better off using a dollar-cost averaging approach. With dollar-cost averaging, you regularly buy shares of the stocks you like, regardless of what the market is doing.

Sometimes, you'll pay less per share for those stocks. Sometimes, you'll pay more. Over time, though, this strategy has been proven to work quite well. And it takes emotions completely out of the equation.

Which stocks to buy?

Perhaps the most important question to ask is, "Which stocks should you buy?" Again, I think it depends. In this case, the answer depends on your personal investing style (especially risk tolerance) and financial goals.

However, I think that the best kinds of stocks to buy in the current market environment are those that are likely to perform well whether there are macroeconomic headwinds or not. For example, Dollar General (DG 0.90%) has delivered a positive year-to-date return despite soaring inflation.

The discount retailer was also a big winner during the booming stock market of the last decade. Consumers always like bargains. They always like convenience. Dollar General provides both. Its prices are low every day. And with 18,500 stores (and growing), there's a Dollar General located within five miles of three-quarters of the U.S. population.

Vertex Pharmaceuticals (VRTX -0.22%) stands out as another great stock to buy right now, in my opinion. Its shares have jumped by close to 30% in 2022, trouncing the major market indexes.

No other drugmaker has an approved therapy that treats the underlying cause of cystic fibrosis. Vertex's cystic fibrosis drugs continue to drive strong revenue and earnings growth for the company. In addition, the big biotech's pipeline features several potential blockbuster candidates.

Dollar General and Vertex aren't nearly as susceptible to economic downturns as most stocks are. They also both have solid long-term growth prospects. Dollar General and Vertex appear to be exactly the kinds of stocks investors should consider buying right now.