Every time you buy or sell stock, you're essentially betting against the person on the other side of the transaction.

The best Wall Street traders know this -- they get fat by eating the lunches of their less-skilled brethren.

When we non-Wall Streeters make trades in our brokerage accounts, we don't have the luxury of knowing the other side of the trade personally. However, we get to participate in a market where thousands of idiots are making bad decisions and bad trades each day.

Join me as I detail two trades one of these idiots made and share how we can take advantage of idiots like this guy today.

The idiot revealed
Before you feel too bad about taking advantage of this idiot, rest assured, he doesn't mind. The idiot is me.

I've made a lot of good stock moves in my day, but I've also made a lot of others that have greatly enriched whoever was on the other side.

The first one I'm going to discuss today happened a few years ago when I failed to take the advice of Motley Fool co-founder Tom Gardner.

The stock I should have sold
In early 2006, I bought shares of online jeweler Blue Nile (Nasdaq: NILE). I was convinced by the recommendations of not one but both of our founding brothers -- first David Gardner in his Rule Breakers newsletter in 2004 and then Tom Gardner in 2005, when he advised on Hidden Gems, our small-cap newsletter.

I was impressed with Blue Nile's push to revolutionize the jewelry industry by educating the public (read: hapless future grooms) on the finer points of finery and then selling them said finery for cheaper prices than their bricks-and-mortar competition. There's certainly some comfort in seeing and touching the merchandise in person, but overall, I saw the jewelry industry in a similar light as I see the used car industry.

I am a believer in the business model of CarMax (NYSE: KMX) because it's bringing customer service and transparency to the ugly used car business. And I am a believer in Blue Nile's business model for similar reasons. The jewelry industry is ripe for disruption, and Blue Nile's doing a great job of establishing itself as the pre-eminent first mover.

Great. So why should I have sold it?

Simple. The stock price got ahead of its prospects. As Tom Gardner noted when he recommended selling the shares in the fall 2007, "I'm delighted with every aspect of our Blue Nile experience. It's been a three-bagger for us in a mere two years. However, at $100 per share and a $1.6 billion market cap, Blue Nile now appears quite overvalued to me." He went on to show that Blue Nile would have to grow its profit by 35% a year to make it a buy.

That's aggressive even for a big grower. (To put that in hindsight perspective, when I look at Blue Nile's growth for the past five years, it's less than 2% per year.)

All of that made sense, but I didn't sell. I sold a few years later in 2009 -- at about half the price. In a market that was down 20%, I still made a 70% gain in three and a half years.

But I could have pocketed a gain of more than 200% instead.

Oops.

Yet, as I'll explain later, David Gardner would say that my mistake wasn't selling at a lower price ... the mistake was me selling Blue Nile at all.

The stock I should have kept
On the flip side, I bought shares of Apple (Nasdaq: AAPL) during the heart of the financial crisis (September 2008) when its shares had fallen to around $110. The naysayers were talking down Apple because it sold high-end, arguably luxury goods in a crummy economy.

At the time, many folks were tightening budgets and shopping downmarket at places like Wal-Mart (NYSE: WMT) and Dollar Tree (Nasdaq: DLTR), as their upcoming quarterly earnings would show. In a prolonged downturn, Wal-Mart and Dollar Tree wouldn't just survive -- they could thrive. It was harder to make that case for Apple.

I was concerned about this as well. But Apple had so much cash and such good products that I was confident it could weather the crisis -- even if it floundered for years.

Of course, that didn't happen. Apple disproved its critics and smashed analysts' earnings estimates and prior-year numbers throughout the financial crisis.

So about a year after I bought, shares were trading at $180 a share, up more than 60%. Happy with my quick gain and worried about valuation, I sold in September 2009.

And now a year and a half later, Apple's stock is almost a double from my sell price.

Double oops.

Damned if I do, damned if I don't
So I lost by not selling. And I lost by selling.

Deciding when to pull the trigger is tough. It's even tougher with higher-growth stocks like Blue Nile and Apple.

One way to deal with this problem is to buy a portfolio of promising, visionary stocks and hold them for the very long term, temporary valuation mispricings be damned. If you choose your companies correctly, the huge winners will more than cancel out the losers.

That's the philosophy of Fool co-founder David Gardner. Recall that both he and his brother Tom had recommended Blue Nile. Unlike Tom, though, he never sold. You and I may say he missed an opportunity to unload shares at $100 a pop, almost 70% higher than today's price. But he'd say we're missing the point. He's sitting on close to a double from his buy-in price, and, if Blue Nile proves itself to be a true Rule Breaker, its growth story is just beginning.

Each of us has our own investing style. While mine differs a bit from David's (and Tom's, too), David's investing philosophy combined with my two bad trades leads to a good investing lesson.

The lesson
The lesson is a simple one but hard to execute. When you've identified a great growth story, be very careful about selling. I clearly underestimated Apple. And even sellers at $100 who never bought back in may ultimately underestimate Blue Nile.

As I look at my portfolio today, I see Intuitive Surgical (Nasdaq: ISRG) trading for a rich 35 times trailing earnings and 25 times forward earnings. But I refuse to sell because of the lesson I learned from Apple. Like Blue Nile, perhaps share prices will dip from today. And there's real danger in pricing in too much growth. But in this case, I think Intuitive Surgical has the opportunity to define a megatrend (robotic surgery) -- much like Apple has been doing with smartphones. We'll see if I've properly learned from my investing mistakes.

If you're interested in learning about another company capitalizing on a megatrend, I invite you to take a free copy of our report "The Motley Fool's Top Stock for 2011." You can access it for free by clicking here.

Anand Chokkavelu owns shares of Intuitive Surgical and longs for those sold Apple shares. Blue Nile is a Motley Fool Rule Breakers selection. Apple is a Motley Fool Stock Advisor pick. The Fool has written puts on Apple. The Fool owns shares of Apple. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.