The 2023 year will soon close, which is a shame. It's been a great year for Wall Street, with the major indexes near their all-time highs. Everyone likes to see stock prices increase, but it can also mean that things are getting a little expensive for their own good.

Eventually, there's a good chance the market will take a step back, which can be scary for investors but is healthy for markets in the long run. When the time comes, it's an opportunity to go after great stocks that are too expensive today. Here are three stocks you can confidently buy after a downturn.

1. Apple

Personal electronics giant Apple (AAPL -0.35%) needs little introduction, considering it's one of the world's best-known brands. The iPhone maker's size is staggering; its $380 billion annual revenue dwarfs other countries' economies, and its $100 billion in annual free cash flow is more than most companies do in sales.

Apple has proven its branding power over time. Consumers routinely buy its hardware and upgrade to a newer version every few years. Today, nearly 1.5 billion people are actively using iOS devices worldwide. Along with devices, consumers buy accessories and sticky subscription services that create recurring revenue streams.

However, Apple's growth can fluctuate between major iPhone updates, and its tremendous size can make it harder to grow. Analysts believe Apple's earnings will increase by 11% annually over the next three to five years, but the stock still trades at a forward P/E of nearly 29. Its 2.6 PEG ratio signals the stock is a bit rich for the growth you'll likely see, making Apple an outstanding stock to reevaluate when the price comes down.

2. Advanced Micro Devices

Artificial intelligence (AI) is the story of 2023, and the hype seems justified. Researchers believe the global AI market can grow 19% annually over the next decade, crossing $2.5 trillion by 2032. That's a lot of opportunity for chipmakers like Advanced Micro Devices (AMD 2.37%), whose chips are the building blocks that power the highly demanding computing loads that AI models create.

Thus far, AMD hasn't delivered eye-popping growth numbers like Nvidia has. Third-quarter data center sales were flat year-over-year because declines in other end markets offset growth in AI applications. But AMD's MI300 AI chip could compete with Nvidia and begin driving growth in 2024 and beyond. That could lift AMD's performance above analysts' modest expectations, which currently call for earnings growth averaging 10% annually over the coming years.

However, investors should think twice before buying AMD today. With the shares trading at a forward P/E of 46, Wall Street has possibly already priced in AMD's upside. Currently, AMD's outperformance in the future would only validate the early buying, while disappointment will likely bring the valuation back down. There's no margin of safety here, so wait for a better entry point before sinking your teeth into these shares.

3. Shopify

Competing in e-commerce with Amazon and Walmart is hard, so businesses are going to software company Shopify (SHOP 1.11%) for help. Shopify sells turnkey software tools to help merchants of any size establish and manage an online store. Collectively, millions of smaller merchants add up to give Shopify a significant retail footprint. Shopify merchants collectively did $56 billion in Q3 sales, compared to $63 billion for Amazon.

As a software company, Shopify is quickly becoming profitable as it grows. The company converted 16% of its revenue to free cash flow in Q3, and generally accepted accounting principles (GAAP) earnings per share (EPS) should begin following along as revenue growth increasingly outruns costs. Analysts believe the company's earnings will nearly double annually moving forward. That's great news for a company with significant growth opportunities still ahead. E-commerce is still just 15% of retail in America.

It would be an excellent setup for substantial investment returns except that the stock's valuation is a bit high after shares ran up by 58% in the past month. Even with such high earnings growth, the stock's forward P/E of 136 means that Shopify could go nowhere for a year and still trade at more than 65 times earnings next year. Shopify is a proven winner with tread left on the tires, but investors should wait for market volatility to decrease the price.