The recent volatility in the stock market is yet another example of why it is so hard to buy and hold stocks. Despite having the highest historical returns, the ups and downs often scare people away at precisely the wrong time. 

That's why many experts say the best strategy is one you can stick to. One that keeps you invested in the market. To that end, I'm highlighting four companies that I believe have the right ingredients to buy and hold forever: Microsoft (MSFT -0.66%), West Pharmaceutical Services (NYSE; WST), ASML Holding (ASML -7.09%) and Home Depot (HD -0.60%). Although they aren't the most exciting stocks to follow, I am confident I can hold them through thick and thin. Here's why. 

An older couple smiling and holding an hourglass as sand runs through it.

Image source: Getty Images.

1. Microsoft

A common metaphor in the business world is trying to rebuild an airplane while it's flying. Since Satya Nadella became Microsoft's CEO in 2014, he has done just that. The company's move to a subscription model and its push into cloud services have led to more than a doubling of revenue and more than a tripling of net operating profit. It should be no surprise that the stock is up 722% during that span.

The company can easily cover the debt it carries and delivers a return on invested capital (ROIC) -- the percentage of debt plus equity that's generated in annual profits after dividends -- of 36%. It has delivered all of this while buying back 10% of outstanding shares and exhibiting less volatility than the overall market. Even though the current yield is a measly 0.8%, it's a combination I can live with.

2. West Pharmaceutical Services

There was a time in late 2021, as COVID vaccines seemed imminent, when people began to worry about the supply of packaging and syringes to deliver the jabs. West Pharmaceutical Services was front and center. The company holds roughly 70% market share in packaging for injectables. It's no surprise that COVID was a tailwind and West Pharmaceutical made the most of its opportunity.

As with Microsoft, operating profit has far outstripped sales despite robust growth. It's up 373% since 2016 while revenue has doubled. The analogies don't stop there. Its beta -- a measure of stock volatility -- is lower than the market, it has little debt, and its ROIC is close to 30%. If you're sensing a theme, you've caught on to why I have no doubt these stocks can have a permanent home in a portfolio.

3. ASML Holding

ASML has similar characteristics to Microsoft and West Pharmaceutical. It has a high ROIC and low debt and exhibits volatility only slightly greater than the overall market. But what makes me confident in its prospects is society's dependence on semiconductors and the company's incredible technological advantage.

The company supplies services, software, and hardware to semiconductor chipmakers. It has a monopoly on extreme ultraviolet lithography machines and enjoys nearly 90% market share in the lithography stepper industry, according to Gartner

The machines fire near-X-ray wavelength light at drops of tin up to 50,000 times per second. That creates ultraviolet light that is guided to silicon wafers by mirrors, where it imprints the desired pattern to an accuracy of about one-four hundred thousandths the width of a human hair. That is a mind-blowing technological achievement.

It's no wonder, too, that they're incredibly expensive. Intel just spent "significantly more than $340 million" on ASML's latest lithography machine.  They're also large. The machines are shipped to customers on four jumbo jets or 40 freight containers. This is not an industry where competition sneaks up on you. And the company has maintained its technical superiority over time. It is in my portfolio to stay.

4. Home Depot

Construction and home improvement is much easier to understand than making semiconductors. From the depths of the housing collapse, this retailer has ridden a resurgence in building and renovation to a 940% stock gain since 2010. It also sports no more volatility than the overall market and has a moderate but manageable amount of debt. Fears of a slowdown in the housing market have sent the shares down 28% so far this year. That's the largest drop in the past decade, except for the brief setback in March 2020. 

Even if rising rates do slow the housing market, it isn't likely to be serious over the long term. A study by Freddie Mac estimated that the U.S. had a shortage of 3.8 million housing units at the end of 2020. Supply chain and labor shortages -- not to mention a pandemic -- are preventing the industry from closing the gap. Whether it's new construction or renovation, Americans have a long way to go -- and a lot of money to spend -- before shareholders of Home Depot have much to worry about. Even if a pause is in store, a ROIC of 44% and a dividend yield of 2.5% is consolation for waiting.