This year's been a tough one for stocks and investors. The three major indexes slipped into bear territory. And the Nasdaq still is down about 27% since the start of January. But these times won't last forever. Bull markets eventually follow bear markets.

We don't know when this transition will happen. But it's still a great idea to plan for it. Especially since so many companies with solid long-term stories have seen their valuations plummet. And some players have exciting catalysts ahead. So, as we approach the end of 2022, let's take a look at five top stocks to buy before ringing in the new year.

1. Amazon

Amazon (AMZN 1.30%) is a leader in two markets set to grow in the double-digits this decade: e-commerce and cloud computing. These businesses have helped Amazon grow earnings into the billions of dollars over time.

But today's higher inflation and other troubles like supply chain issues have been weighing on Amazon. As a result, Amazon's reported declines in operating income. And free cash flow has turned to an outflow. This is painful in the short term. The stock has slipped nearly 40% so far this year.

The good news is the long-term picture remains bright. Amazon has the market position and financial resources to weather these times. The company's revenue still is growing. And members of its Prime membership program are spending more and more on Amazon. Amazon also is strengthening its cost structure. This will be a plus down the road.

Today, Amazon shares are trading for around their cheapest in relation to sales in the past six years. So, the best deal this holiday season may be on Amazon shares.

2. Teladoc Health

Teladoc Health (TDOC 3.31%) sank 63% this year. The telemedicine leader disappointed investors with two billion-dollar non-cash goodwill impairment charges. This deepened investors' worries about the company's lack of profitability.

But the toughest times may be behind Teladoc. In the third quarter, Teladoc narrowed its net loss. The company's revenue and visits continued to climb in the double digits. And Teladoc said deal size today is about 50% bigger than the average deal a year ago.

Companies hurt by today's economic environment and coronavirus disruptions have taken longer than expected to finalize their Teladoc plans. These are temporary issues. And when the situation improves, Teladoc could see a clear rebound. As it stands, the company has managed to increase U.S. member numbers and revenue per member from quarter to quarter.

Right now, Teladoc shares are trading at 2.3 times sales. This is nearly their lowest ever by this measure. Considering growth prospects, now looks like a good time to get in on this recovery story.

3. Vertex Pharmaceuticals

Vertex Pharmaceuticals (VRTX 1.25%) is one of this year's stock market winners. The shares have advanced 38%. But Vertex may just be getting started. That's because the company is at an important transition point.

The biotech company already is a solid leader in the cystic fibrosis (CF) treatment market. The CF portfolio brings in billions of dollars in revenue and profit annually. But Vertex is about to expand into another significant treatment area.

This month, Vertex and partner CRISPR Therapeutics are submitting their candidate for blood disorders beta thalassemia and sickle cell disease to regulators in the U.S., Europe, and the U.K. If all goes smoothly, the product could launch in the near future. So, Vertex has a clear catalyst ahead.

Vertex's pipeline also includes other potentially big products such as candidates for pain management and type 1 diabetes. So, a few years down the road, Vertex still will be a CF leader -- but it may also carve out significant revenue opportunities in other markets too. That's why it's a good idea to get in early on this innovative biotech player.

4. Costco

Costco (COST 1.01%) shares have outperformed the market this year. But they've still lost about 9%. This means they're less expensive in relation to forward earnings estimates than they were earlier in the year.

What's another reason to buy Costco now? Today's economic woes actually work in Costco's favor. That's because the company sells items in bulk and at dirt cheap prices. As shoppers watch their budgets this holiday season, they may favor buying at a place like Costco -- and taking advantage of their membership.

You pay an annual fee to shop at Costco. So, it's to your advantage to do as much of your shopping there as possible. Beyond troubled economic times, this annual fee plays a key role in Costco's success. That's because membership fees are high margin for the company. They don't involve major costs linked to actual merchandise -- like transport and storage, for example.

Costco's highest price membership level -- Executive membership for $120 a year -- is growing. And it now makes up almost 72% of total sales. That's a very encouraging sign for Costco's future.

5. Carnival

Carnival (CCL 3.57%) (CUK 3.71%) probably is the riskiest bet on this list. But if you're comfortable with some risk, it's a good stock to consider. The pandemic crushed Carnival by halting its cruising operations. As a result, the company's earnings plunged, and debt ballooned.

CCL Net Total Long Term Debt (Annual) Chart

CCL Net Total Long Term Debt (Annual) data by YCharts

Today, Carnival still is dealing with these problems. But some bright spots give us reason to believe in the long-term story.

In the most recent earnings report, Carnival's adjusted earnings before interest taxes depreciation and amortization (EBITDA) turned positive for the first time since its ships resumed sailing. Revenue climbed 80% from the previous quarter. And booking volumes rose above the high 2019 levels.

Carnival also is taking steps to lower costs and boost revenue. One of those efforts is removing small ships from the fleet and replacing them with larger, more efficient ships.

Today, Carnival trades at 1.6 times sales. That's lower than the level of about 3 times sales prior to the pandemic. Carnival's earnings situation is a lot different than it was back then. But if Carnival makes progress on approaching profitability and reducing debt, the stock could climb from today's levels -- and that means a buy today could be a winning move.