Uncertainty is in the air. The stock market has fallen. There's yet again conflict in the Middle East. Interest rates remain high. Inflation is still worrisome. A federal government shutdown could possibly be around the corner. 

Investors are understandably cautious and concerned. The wrong move could result in financial losses. Should you buy stocks right now? Here's what Warren Buffett is doing.

Warren Buffett.

Image source: The Motley Fool.

Buy stocks, but be picky

Buffett made his massive fortune by investing in stocks. And he has continued to buy this year despite all of the turmoil. However, the Oracle of Omaha has been very selective about which stocks he has purchased for Berkshire Hathaway's (BRK.A -0.57%) (BRK.B -0.24%) portfolio.

First of all, Buffett has stayed within his circle of competence. He has only bought shares of companies for which he had a good understanding of their underlying businesses. It shouldn't be surprising whatsoever that Buffett's largest investment so far in 2023 is none other than Berkshire Hathaway itself. Berkshire spent $5.8 billion on stock buybacks in the first half of the year. 

As is his customary practice, Buffett has also only bought stocks with attractive valuations. For example, in the second quarter, he initiated a new position in D.R. Horton (DHI -2.12%), the largest homebuilder by volume in the U.S. D.R. Horton's forward earnings multiple is only 7.5x, according to YCharts -- roughly the same level as at the beginning of Q2.

But the legendary investor wouldn't have bought shares of D.R. Horton or any other company if he didn't feel good about their long-term business prospects. In D.R. Horton's case, Buffett probably liked its growth opportunities given the ongoing U.S. housing shortage.

Sell stocks when they don't merit a high level of confidence

Buffett once stated that his "favorite holding period is forever." However, a cursory examination of his trades in this year alone shows that he's willing to sell stocks after owning them for relatively short periods.

This statement, though, doesn't mean what many think it means. Here's the full quote: 

When we own portions of outstanding businesses with outstanding managements, our favorite holding period is forever. We are just the opposite of those who hurry to sell and book profits when companies perform well but who tenaciously hang on to businesses that disappoint. Peter Lynch aptly likens such behavior to cutting the flowers and watering the weeds.

Metaphorically pulling the weeds out by selling the stocks of businesses that aren't outstanding (or that no longer have an attractive valuation) is prudent, in Buffett's view. He has done just that in recent months, cutting Berkshire's stake in HP, as well as selling other stocks.

Build up a solid cash stockpile

Buffett has always been a believer in keeping some cash available to be able to capitalize on great buying opportunities. The less attractive stock valuations are, the more cash he'll accumulate to deploy when share prices come down.

What's Buffett doing these days? Building up a big cash stockpile. As of June 30, 2023, Berkshire's cash, cash equivalents, and U.S. Treasury bills totaled $141.9 billion.

By the way, the majority of that amount (nearly $122 billion) is socked away in Treasurys. That seems smart considering that U.S. Treasury bills are safe and currently offer attractive yields of well over 5%.

Be like Buffett?

Your risk tolerance and investing goals could be different from Buffett's. Therefore, it doesn't always make sense to invest exactly as he does.

However, I suspect that most investors would be well served by copying what he's doing in today's environment. Only buy stocks of outstanding businesses that you understand and that are attractively valued. Sell any stocks you're not confident about. Keep plenty of cash on the sidelines.

Buffett doesn't know what's going to happen with the economy or the stock market. No one does. Following in his footsteps with these moves, though, could enable you to successfully navigate whatever comes next.