It's been a tough few weeks for investors. The S&P 500 has slid about 7% over the past two weeks, and the Nasdaq Composite declined more than 8% over that same timeframe. The pullback put the Nasdaq deep into bear market territory, with the index down more than 25% year to date. This weakness in the market, however, is presenting opportunities.

At some point, this bear market will reverse. When it does, investors may benefit from owning the right set of companies -- businesses with growing revenue, profits, and attractive valuations. As investors search for good stocks to own for the next bull market, one worth considering is The Trade Desk (TTD 0.85%). The debt-free, fast-growing digital advertising company is well-positioned to succeed and -- hopefully -- reward shareholders handsomely.

Strong growth in a tough environment

As advertisers struggled through a rough second quarter, demand-side platform (DSP) The Trade Desk managed to thrive. The company grew its revenue 35% year over year. This compares to Meta Platforms' 1% consolidated revenue decline and Roku's 26% growth in its platform business (down from 39% growth in the first quarter).

Even worse, the midpoint of Meta's revenue guidance for the third quarter implied an even steeper year-over-year decline in that period, and Roku said its third-quarter consolidated revenue should grow just 3% (down from 18% growth in Q2). Meanwhile, The Trade Desk guided for third-quarter revenue to increase 28% or more year over year.

"The Trade Desk has become increasingly indispensable as the default DSP for the open internet and connected TV," said The Trade Desk CEO Jeff Green in the company's second-quarter earnings call.

Green further explained that uncertain macroeconomic environments ultimately drive new customer growth and incremental market share gains from existing customers because advertisers are looking to maximize every ad dollar spent during these times. They need an effective data-driven advertising platform with access to a wide variety of inventory to help them get the most out of their ad spend.

Green said:

Throughout the first half of 2022 and particularly in the second quarter, I believe we have gained more market share or grabbed more land than at any period in our history. And in large part, that's because as marketers become more deliberate with their budgets, they are prioritizing advertising that delivers the highest return.

A healthy balance sheet for uncertain times

In addition to The Trade Desk's strong growth profile, the company is highly profitable, has lots of cash, and carries no debt. These are good qualities for investors to look for in their investments during bear markets and, more specifically, uncertain times. Investors need resilient companies during these periods while they hope for the economy to start showing signs of improvement.

A bull facing off against a bear.

Image source: Getty Images.

The tech company wrapped up its second quarter with about $1.2 billion of cash, cash equivalents, and short-term investments, and its free cash flow was $86 million in Q2 alone.

The Trade Desk's market share gains, impressive profitability, and healthy balance sheet highlight why investors may want to buy into the stock's 7% dip over the last two weeks and hold shares for the long haul. If the company is able to win in this tough environment, imagine what it can do when ad budgets pick back up again. Furthermore, it might be wise to pick up shares of this stock while the overall market is still pessimistic. After all, a stock like this could soar during a bull market.