You know it's coming. 

Sooner or later, the current long-in-the-tooth bull market will end -- probably in tandem with an economic downturn. What will you do when it happens? For some, the answer is to panic. A better approach, though, is to take advantage of the opportunity to buy solid stocks at lower prices that should perform well over the long run. 

Three such stocks that would be great picks when the bull market fizzles are Celgene (CELG), Facebook (META -0.52%), and Wal-Mart Stores (WMT 1.32%). Here's why.

Shadow of a bear on stock quotes page

Image source: Getty Images.

Celgene

Celgene isn't the kind of stock that's immune to being dragged down in the midst of a broader market pullback. Between August 2008 and May 2009 -- the worst months of the economic crisis of the previous decade, the biotech's share price plunged more than 40%.

However, Celgene should keep on making lots of money even if the market drops and the economy falters. Physicians won't stop prescribing the biotech's top drug, Revlimid, to patients with blood cancer. Celgene's other blockbuster drugs, Otezla and Pomalyst, shouldn't skip a beat, either.

Scientists looking at monitor

Image source: Getty Images.

And the company certainly wouldn't slow down in rolling out its solid pipeline candidates. Ozanimod, which targets treatment of multiple sclerosis, ulcerative colitis,, and Crohn's disease, should become a massive success regardless of what the stock market does. So should blood cancer drug luspatercept and several other pipeline drugs. 

Celgene is in great shape to grow earnings by more than 20% over the next several years, whether those are good or bad years for the economy in general. The stock currently trades at 15 times expected earnings. If the bull market fizzles out, Celgene should be an even more attractive growth stock for the long run.

Facebook

Facebook could be negatively impacted during a market downturn that's linked to tough economic times. Advertising generates nearly all of the social media giant's revenue. Companies could cut back on advertising in a down economy.

However, there's a potential positive for Facebook. People could spend more time on social media if they don't have as much disposable income to spend on entertainment. Increased traffic is good for Facebook. Advertisers typically pay when a person clicks on the ad. The more people on the company's social media sites, the more likely they are to click on the ads. 

People using mobile devices

Image source: Getty Images.

Even if Facebook's share price fell in an overall market pullback, it's still a great long-term stock to own. The company has a natural growth opportunity by putting ads on its Messenger application. Considering that there are 1.2 billion users of Messenger, this could be huge for Facebook.

Facebook stock is currently priced at nearly 27 times expected earnings. That might seem expensive. However, the company is expected to grow earnings by 26% annually in the coming years. This kind of growth makes Facebook's valuation more appealing. A drop in the share price would present a great opportunity to profit when the market rebounds.

Wal-Mart

Wal-Mart stock wouldn't be spared from a general market pullback, either. However, if history is a guide, the retail giant's shareholders wouldn't feel as much pain as most investors would. Between August 2008 and May 2009, Wal-Mart stock only fell by 14% -- much less than the broader indexes.

The company enjoys some level of insulation from bad economic times because it's known for low prices all the time. Consumers who might would shop elsewhere during strong economies could turn more to Wal-Mart when their finances are stretched.

Walmart store

Image source: The Motley Fool.

Some might worry about the threat that online competition presents to brick-and-mortar retailers like Wal-Mart. That is a real concern, but I think Wal-Mart is in a better position to fend off competition than most. Also, Wal-Mart isn't yielding the online market without a fight. In the first quarter of 2017, the company's e-commerce sales soared 63% compared to the prior-year period.

Buying Wal-Mart at a discount during a market downturn would allow investors to profit from the eventual comeback. Also, it would enable locking in at a higher yield. Wal-Mart's dividend currently yields 2.76%. A decline in the stock could potentially push that yield up to 3% or more -- a quite attractive level for long-term investors.