The past 16 months or so have no doubt tested the patience of technology-focused investors as share prices for many stocks in the sector tumbled far and have yet to fully recover. Thankfully, the start of 2023 saw some significant improvement in the market's view on tech stocks, as evidenced by the tech-heavy Nasdaq Composite climbing 13% in January. 

Over the long term, technology stocks have proved to be a great place for investors to put their money, and two tech stocks with great potential for investors over the next decade or so are The Trade Desk (TTD -2.58%) and Apple (AAPL -0.20%). Here's why. 

A person looking at a computer.

Image source: Getty Images.

1. The Trade Desk 

The advertising industry may look a bit precarious right now as spending slowed down over the past year amid economic uncertainty. But don't count out the long-term potential of this vast market. Global spending on digital advertising will total an estimated $696 billion by next year, up from about $567 billion in 2022. 

The Trade Desk is already doing a great job tapping into the digital ad market, with sales climbing 31% year over year to $395 million in the third quarter. The Trade Desk will report its latest quarterly results later this month, and management expects fourth-quarter revenue to increase 24% year over year to $490 million. 

But it's not just sales growth that potential investors should think about when considering The Trade Desk. The company is also leading the charge in the industry's transition away from online trackers, called cookies. The Trade Desk has developed an alternative tracker called Unified ID 2.0 that gives advertisers a way to sell targeted ads while giving online users more privacy. A growing list of advertisers are jumping on board with The Trade Desk's Unified ID trackers, including Amazon Web Services, fuboTV, and The Washington Post.

The Trade Desk's stock isn't exactly cheap, with its shares trading at a price-to-sales ratio of 17 right now. But the stock is much cheaper than its P/S ratio of about 30 this time last year, and long-term investors will likely benefit as this company grows into the expanding digital advertising industry. 

2. Apple

Let's address the elephant in the room first -- Apple didn't exactly have a great Fiscal 2023 first quarter. The company had its first quarterly revenue decline since 2016, with revenue falling by 5% from the year-ago quarter, and it also missed analysts' average consensus estimates for both its top and bottom lines. But Apple is hardly alone among technology companies reporting disappointing quarterly results lately, and I think there's still reason for optimism.

For one, unlike riskier tech investments right now, Apple still generates plenty of cash. The company generated $34 billion in operating cash flow in the quarter, giving investors plenty of reasons to believe that the company is still in solid financial shape.

Additionally, while some other Apple segments suffered recently, the company's services segment had a record quarterly revenue of $20.8 billion. This shows Apple's resilience even during a tougher macroeconomic environment.

And finally, Apple still has substantial prospects in new revenue categories, namely augmented reality and virtual reality. The company could release a mixed reality headset (for both AR and VR) sometime this year, according to recent reporting from Bloomberg

The AR/VR market potential is significant, with the size of the industry estimated to more than double from $25 billion last year to $52 billion in 2027. Apple could take a slice of that from both headset sales and app sales, similar to the company's winning formula that it's used for the iPhone. 

One quick thing to remember

Tech stocks are still a bit volatile right now as investors try to figure out where inflation is going, what the Federal Reserve will do with interest rates, and if there will or won't be a recession.

No one has a crystal ball to see what the short-term outlook of the market will be, but history shows buying and holding stocks for years is still a great way to build wealth.