If you invest, and you're honest with yourself, you'll look back on your actions and inactions and see things that cost you a heck of a lot of money. Two types can drive you particularly crazy: companies that you looked at and liked that proceeded to run into the stratosphere, and companies that you owned and sold that did the same.

Investing masochism
I keep a portfolio of these things, mostly because I enjoy torture. Most painful for me is my non-investment in Tatneft (NYSE:TNT), a Russian oil exploration and production company. In 2004, shares of Tatneft and other Russian/former Soviet oil and gas companies were hurt by concerns about how the Russian government had functionally nationalized the most valuable assets of oil giant YUKOS. Tatneft dropped from $30 to $20 per share. I was interested. I was excited. I wanted to read up a little more ...

.and the stock started rising, never looking back. It now sits at $105 per share -- a little expensive, but not very. That's a multibagger, missed. It wasn't the first. It won't be the last. It's always a mistake to anchor your buys and sells on the price at which you first saw them, because businesses change with price. But still, for those of us who looked hard at USG (NYSE:USG) when it traded below $10, it's hard not to do this.

Sometimes, once-in-a-lifetime chances happen, well, twice. (At least.) Sometimes the reason for the stock's retracement is clear, and sometimes it's just straight volatility. Motley Fool Hidden Gems Watch List stock Denny's (NASDAQ:DENN), a bona fide turnaround company, has seen its shares move rapidly between $4 and $6 per share and back again. That's not the stuff multibaggers are made of, but it's a big move nonetheless. Sometimes companies really do give you several chances to buy at a good price.

Cheap is cheap
Keep in mind: That "good price" may not be as low as you'd like. How many times have you looked at a company and said, "Wow, this looks great! I wish I had seen it six months ago when it was a whole lot cheaper!"

When companies give you a second chance, the tumble in their stock price usually relates to bad news. Most investors will buy into the negativity and hold off on buying, worried that the shares will drop further. But a good price is a good price. And if that price gets a wee bit better -- or a lot better -- in the following weeks, it doesn't matter; if you're right about the company's prospects, eventually the market will agree with you. (This is much easier to do with companies that you know particularly well, so be sure to do your due diligence.)

While we preach long-term investing, sometimes opportunities can be fleeting. General Dynamics (NYSE:GD) doesn't drop down to $50 per share for long (as it did suddenly in early 2003). Procter & Gamble (NYSE:PG) doesn't lose 40% of its value for long (as it did in 2000). Home Depot (NYSE:HD), one of the great growth stories of the past decade, lost 70% of its value, from $70 to $20, among titters that the company was being killed by rival Lowe's (NYSE:LOW). It gave all those people who missed out on the Home Depot machine the first time around a second bite at the apple. How many did so?

The Foolish bottom line
When companies and stocks become detached from one another, you need to be ready. The great investors, from Warren Buffett to David Nierenberg to Peter Lynch, recognize that when the market is gloomy about companies, it's almost always the right time for you to be interested.

Bill Mann is co-editor of the Motley Fool Hidden Gems newsletter service, where he seeks to consistently exploit the market's inefficiencies related to small-cap stocks. He invites you to be his guest for free with a30-day trial.

Bill owns shares of Denny's. Home Depot is a Motley Fool Inside Value recommendation. The Fool has a strict disclosure policy.