Twenty years ago, investing $1,000 in stocks might not have seemed like enough to make a big difference in your portfolio.

It turns out that the Invesco QQQ ETF ( QQQ -0.65% ) would have proven many people wrong.

Over that time, this fund generated an average annual return of 16.6%, or more than 2,000% in total. That $1,000 would have grown into more than $21,000! And that's with not another penny being added along the way.

But earning that kind of return would have required a remarkable amount of patience and discipline. Even though the tech bubble popped more than 20 years ago, investors in the past two decades would have had to endure 20% corrections in 2018 and 2020, as well as a drawdown of more than 30% in 2022.

Many investors would have waved the white flag on the Invesco QQQ ETF at least once during that time. But that's why a long-term buy-and-hold strategy is so important.

When people try to time the market, they usually sell only after stock prices have fallen, which essentially locks in losses. And they typically don't reenter the market until much of the subsequent recovery has already occurred.

NASDAQ : QQQ

In other words, they capture the losses and miss out on the gains. That pattern can significantly damage long-term returns.

Of course, returns over the next 20 years are anybody's guess. But the best opportunity to capture those gains is to invest and simply let the long-term power of compounding do its thing.