Vertex Pharmaceuticals (VRTX 0.10%) is one of the stocks that's defying this bear market. The biotech is up 30% so far this year. So, this leader in cystic fibrosis treatment has delivered gains in a short period of time. But what about over the long term?

It's best to hold onto stocks you buy for at least five years, and if a company's growth prospects look good, you'll probably want to keep it in your portfolio a lot longer. But today, let's consider how you would have fared if you had invested $5,000 in Vertex Pharmaceuticals five years ago, and also consider whether it's a good investment from here.

More than doubled

In July 2017, you could have picked up Vertex for $129 a share, so an outlay of about $5,000 ($5,031, to be precise) would have purchased 39 shares. Today, the stock is trading at $286.The value of your 39 shares would have more than doubled to $11,154.

The road during that period wasn't completely smooth for Vertex. The stock reached a low point back in 2020 after the clinical trial failure of a candidate in its alpha-1 antitrypsin deficiency program. Investors worried Vertex was struggling to expand its catalog beyond its cystic fibrosis program. As a result, the shares suffered all the way through 2021.

VRTX Chart

VRTX data by YCharts

What brought about the stock's recovery? Vertex and partner CRISPR Therapeutics reported positive data from a late-stage clinical trial for their gene-editing treatment candidate for blood disorders. And the companies said they would file for regulatory approval by the end of this year.

The candidate is intended to be a one-time curative treatment for beta-thalassemia and sickle cell disease. This is huge because, right now, treatment options for these blood disorders are limited. Vertex is looking at a potential blockbuster.

Plenty of growth ahead

All of this has boosted investor confidence that Vertex can indeed expand beyond its core indication. It's also important to keep in mind that cystic fibrosis is far from being an old business on the decline. Vertex's star treatment, the triple-drug therapy Trikafta, generates billions in revenue annually -- and there's still plenty of growth ahead.

Trikafta has the ability to treat 90% of cystic fibrosis patients. Out of that group, 25,000 patients in North America, Europe, and Australia aren't yet receiving the therapy, for a couple of reasons. Health care agencies in some countries only recently agreed to cover it, and some haven't yet done so. And some cystic fibrosis patients will have to wait until Trikafta is approved for younger age groups, or until they age into eligibility.

Vertex also has said that its cystic fibrosis leadership should continue until at least the late 2030s. All of this means Vertex's growth prospects look bright. Its legacy business ensures billions of dollars in revenue annually. The blood disorders candidate may soon reach commercialization.

And the company also has a pipeline with other exciting programs, such as a candidate to treat type 1 diabetes -- another disease with limited treatment options. Vertex's candidate is intended to restore the body's ability to regulate blood sugar levels. If it's successful, it could be a game-changer for diabetes patients and the company.

Should you hold on?

Now, considering all of this, should long-term holders of this stock sell to lock in their gains? Or should they hold on?

I favor holding on, and that's what I'm doing as a Vertex shareholder. The pharmaceutical's main business is going strong. It's about to apply for regulatory approval of a potential blockbuster treatment. And its pipeline is solid.

Vertex also has more than $8 billion in cash on the books that it can use to further advance its pipeline. A perfect example: Vertex recently announced its acquisition of ViaCyte, which has tools and technologies that should accelerate its type 1 diabetes program.

Vertex has shown it can deliver over the long term, and the story isn't over. This innovative biotech company has what it takes to continue driving gains for investors in the years to come.