Consensus is comforting in times like now, when all investors see is red in their portfolios. But is running with the herd a good way to protect yourself, or are you asking to be trampled? The herd that is Wall Street has flocked to some stocks, evidenced by their stubborn elevations that remain higher than most.

Take cloud services provider Cloudflare (NET -1.64%); yes, the stock has taken its hits on the chin, falling 72% from its peak. But look around the technology sector, and you'll quickly see the premium from which it still trades. Here is why the generally positive sentiment toward the stock creates risk for shareholders.

Cloudflare versus the field

Don't interpret this as a bearish take on Cloudflare's business; my only goal is to help you succeed as an investor. The company offers various internet services through the cloud and seems poised for long-term success. But stock prices move like a popularity contest in the short term and based on fundamentals over the long term. That's why stocks can get expensive and nobody bats an eye, but when they plummet to bargain levels, people run for the exits.

You can look at a company's fundamentals in several ways, but it can boil down to a few common themes:

  • How fast is it growing?
  • How much money is it making?
  • How much are you paying for it?

Check out how Cloudflare compares to other software companies in these critical areas. These companies do different things, but they're all software-based companies that typically sell their product on a subscription basis, commonly referred to as software as a service (SaaS).

NET Revenue (Quarterly YoY Growth) Chart

NET Revenue (Quarterly YoY Growth) data by YCharts

The charts you see above include Cloudflare, Monday.com, MongoDB, Twilio, and CrowdStrike Holdings. You can see that Cloudflare's revenue growth is somewhat middling in this group; it's not growing as fast as Monday.com or CrowdStrike, about on par with MongoDB, and a notch above Twilio. You can also see how Cloudflare's cash burn is among the worst in this group. Yet the stock's valuation measured by the price-to-sales ratio (P/S) is the highest. CrowdStrike is the only company valued anywhere near Cloudflare's P/S, but is significantly free cash flow positive, arguably a reason it should be valued higher than Cloudflare.

The downside of herd mentality

An investor should see a headscratcher like this and ask whether Cloudflare deserves such a high valuation. Paying a high valuation for a hot stock works until sentiment changes; hypothetically, the broader market could decide that Cloudflare no longer deserves a higher P/S ratio. Imagine growth slows, or something else happens. Matching the other stocks' valuations would mean a 50% haircut from its current price!

That's the risk of buying whatever the hot stock on Wall Street is. It doesn't always backfire, but you should know how different stocks stack up on valuation and fundamentals. There are plenty of instances throughout history where stocks were temporarily popular but ended up being miserable investments over the long term.

One more time, this isn't a shot at Cloudflare; just cautioning that its premium valuation could backfire on investors. Trying to predict the stock market is a mistake; don't do it! Thoughts like, "well, everyone likes this stock, so it will keep winning." Or, "This stock already fell X%; it can't possibly keep going lower!" are asking for a painful lesson. Remember that the stock market can be irrational in the short term, so don't try reasoning with it.

So what should you do with Cloudflare?

How do you come out ahead despite all of the uncertainty? Maintaining a diversified portfolio of fundamentally strong companies will significantly increase your odds of building wealth over the long term. Cloudflare can undoubtedly be a part of a successful portfolio, even if the share price continues falling over the coming weeks or months. An investment thesis can take years to play out, which is why it's generally a good idea to hold stocks for at least five years.

You can't know for sure where Cloudflare's lowest valuation will be. So to protect yourself, you can dollar-cost average your way into positions, slowly buying a little at a time to make sure you don't jump in too soon with both feet, forcing you to watch as your investment shrinks in a bear market.