Some investors wonder, if they limit themselves to just high-quality companies, whether buying and selling stock frequently would be so bad. It's a fine question.

The problem is, it's not always easy to discern exactly what is or isn't a high-quality company. And even big, established names such as Nike (NYSE:NKE) and Gap (NYSE:GPS) can experience protracted slumps. In the short term, you're never guaranteed smooth sailing.

Let's examine the disadvantages of trading frequently, though. Imagine that you bought $10,000 worth of stock in Sharma's Secret Passwords Inc. (ticker: SHHHH). It was a smart purchase -- within about 10 months, it's doubled, and your shares are worth $20,000. You have a choice. You can continue hanging on, or sell and buy something else.

We'll assume that you're still bullish on SHHHH and don't think it's terribly overvalued, but that you also have high expectations for Claudius' Tie-Dyed Togas (ticker: TOGAZ). Let's also assume that your expectations are correct -- both will end up doubling within a year! Here are two possible scenarios for you:

1. You hang on to your SHHHH shares, and they double again, to $40,000.

2. You sell your $20,000 of SHHHH shares to buy shares of TOGAZ. Let's say that you're in a 33% tax bracket. That means $3,300 of your $10,000 gain will go to Uncle Sam (unless you hold SHHHH for more than a year, in which case 15%, or $1,500, of your gain would likely go to our favorite uncle). Out of the $20,000 of shares you sold, you now have $16,700 to reinvest in TOGAZ. You do so, and within a year, it's doubled to $33,400.

This should give you an idea of what happens when you trade frequently. The more you trade, the more you surrender in the form of taxes (and brokerage commissions). If you hang on to shares of a great company for decades, you will eventually sell and pay taxes (unless the shares are in a Roth IRA), but the overall hit will likely be lower than if you'd been steadily trading all along.

Of course, if you think that SHHHH has run its course or you no longer have any faith in its future prospects, then you should sell your shares. And if you think that TOGAZ will grow considerably faster than SHHHH, then selling might be smart. Taxes shouldn't rule all your decisions. Just keep them in mind and focus on stock valuations and your best ideas.

To learn more about investing Foolishly, visit our Fool's School and our Investing Basics area. Or check out some of our inexpensive and well-regarded online how-to guides, which feature money-back guarantees. You can also learn all about brokerages and find one that's right for you in our Broker Center.

And if you're looking for some high-quality companies in which to possibly invest, grab a free trial or one or more of our investing newsletters, and you'll be able to see lists of stocks we've recommended.