The NASDAQ lost its momentum in recent months as a resurgence of COVID-19 infections, inflation fears, rising bond yields, the debt ceiling fight, and a potential real estate crisis in China all spooked investors.

The index has retreated about 7.5% from its all-time high over the past month, but a deeper correction can still occur if the macro headwinds intensify. If the market does continue to tumble, I'll be looking for an opportunity to buy these three expensive tech stocks on sale.

1. Cloudflare

Cloudflare's (NET 1.80%) platform accelerates the delivery of digital content to a website's visitors through its content delivery network (CDN). At the same time, it can shield websites from cyberattacks and direct websites to the correct IP address through its DNS (domain name system) service.

A child holds a blackboard with "buy" and "sell" arrow signs.

Image source: Getty Images.

Cloudflare "serve[s] data from 250 cities in over 100 countries around the world," and it processes an average of 25 million website requests every second. It primarily works behind the scenes, but you've likely encountered its defenses, which ask users to prove they're humans instead of bots, across the web.

The company often refers to itself as a "water filtration" system for the internet, which reduces the need for traditional cybersecurity services. Its growth rates indicate there is growing demand for such filtration -- revenue was up 50% in 2020, and management is targeting approximately 46% top-line growth this year after raising its guidance twice. Cloudflare also ended the second quarter with an impressive dollar-based net retention rate of 124%.

However, Cloudflare isn't profitable yet, and its stock trades at 59 times this year's expected sales. Its long-term prospects look bright, but it's trading at a much higher price-to-sales ratio than comparable companies like Fastly and Akamai. Therefore, I'd be much more bullish on Cloudflare if its valuations cool off.

2. Shopify

Shopify's (SHOP -3.41%) e-commerce tools enable merchants to sell their products online without joining an existing marketplace like Amazon. It helps over 1.7 million businesses set up their own online shops, process payments, fulfill orders, manage their marketing, and more.

The company was already firing on all cylinders prior to the pandemic, but the crisis caused its growth to accelerate as more businesses and shoppers moved online. Revenue surged 86% in 2020, and analysts expect revenue to rise another 98% this year.

Shopify also turned profitable on a GAAP basis in 2020, while its non-GAAP earnings per share increased 13-fold. Analysts expect its non-GAAP earnings to grow another 89% this year.

This platform will continue expanding as it challenges Amazon and other e-commerce giants with a decentralized network of smaller merchants. That disruptive potential has helped Shopify deliver incredible returns for its shareholders, and it still looks like a great growth stock for the future. But it's also priced for perfection at 199 times forward earnings and 35 times sales. Those high valuations, along with tougher post-pandemic comparisons, could drag down its stock during a market crash -- but a major pullback would also represent a golden buying opportunity.

3. The Trade Desk

The Trade Desk (TTD 1.61%) is the world's largest independent DSP (demand-side platform) for digital ads. A DSP enables trade desks, ad agencies, and advertisers to bid on ad inventories.

The Trade Desk has kept its retention rate above 95% for seven straight years, and it expects the expansion of its CTV (connected TV) business to reduce its dependence on desktop and mobile ads. That strategic shift, which many other ad-tech companies are also executing, should enable it to offset Apple's recent privacy changes on iOS and Alphabet's upcoming ban on third-party cookies in its Chrome web browser.

The Trade Desk's revenue rose 26% in 2020, even as the pandemic throttled ad purchases from certain sectors, but revenue jumped 67% year over year in the first half of 2021 as those headwinds waned. Analysts expect revenue and earnings to rise 40% and 3%, respectively, for the full year.

The Trade Desk's future looks bright, but its share price reflects investors' optimism. The stock trades at 91 times forward earnings and 27 times this year's sales, even after shares have declined over 30% from their all-time high. I'm sticking with cheaper ad-tech stocks for now, but I'd be interested in adding The Trade Desk to my portfolio if a sell-off brings its price down further.