"Hey, John. How'd you make out last quarter? The market took a beating in late February. How did you do?"

"Oh, I don't worry about that stuff, Bob. Let me tell you what I did five years ago. Picked this great company, Yahoo! (NASDAQ:YHOO), and, while it went down at first, it's done really well for me since then. More than makes up for the loss I have from holding Intel since then."

"Great, John. But how'd you do last quarter?"

How many times have you heard such a conversation at the bar or a party? Probably not too often. But I'd bet that John retires before Bob, thanks to his long-term investing outlook. After all, five years with a greater-than-20% annual return from Yahoo! would help boost any portfolio.

Panic in a 2.5% drop
The day Bob referred to was a great example of investor panic. The Dow lost more than 400 points on Feb. 27. It was down as much as 550 points at one point. The volume was more than 381 million shares, some 66% higher than the day before. People sold shares left, right, and backwards. The news was filled with nothing but doom and gloom.

You know what, though? The Shanghai index that helped start the horrible day took only three weeks to bounce back from its 8% drop and set new record highs. The Dow? It took just over five weeks to recover from its own drop.

Were you in panic mode in late February? Or did you grit your teeth and sit through it, coming out the same or even better after a bit more than a month? If so, congratulations on not letting your emotions get the better of you. You've taken to heart the lesson of Buy Great Companies and Be Patient.

Don't be All Shook Up
Warren Buffett has said at various times that we should invest as if the stock market would be closed for the next several years. That's a vote for long-term holding and not being rattled by short-term movements if I ever heard one. Benjamin Graham said something similar with his famous quote about how, in the short term, the market is a voting machine, in the long term a weighing machine.

But if you're not going to be rattled out of your investments, what type of companies should you buy? Focus on businesses that have competitive advantages, brand loyalty, savvy management, and a long-term focus.

For instance, Microsoft (NASDAQ:MSFT) has a wide competitive moat -- its operating systems are widespread, and switching costs can be high for customers. Altria Group (NYSE:MO) and Procter & Gamble (NYSE:PG) sell products that consumers use up and replace all the time, and they have years of dividend increases that have rewarded long-term shareholders. Starbucks (NASDAQ:SBUX) has an intensely loyal customer base and is growing worldwide.

Companies with these characteristics will give good long-term results while shrugging aside the slings and arrows of the short-term market. Consider: Over the past 10 years, the S&P 500, including dividends, has returned just 7.9% annually. Compare that with Microsoft (8.9%), Altria Group (14.3%), Procter & Gamble (9.5%), and Starbucks (23.8%). Pick good companies, hold for the long term, and you can get market-beating returns.

In sum
Are you ready to be more like our fictitious friend John? Good. Shrug off the market's schizophrenic short-term ways. Buy great companies, be patient, and avoid panicking when the market panics, as it did in late February.

That's our goal at Motley Fool Stock Advisor. Fool co-founders David and Tom Gardner have selected great businesses with the intent of holding them for the long term -- and since inception in 2002, those recommendations are beating the S&P 500 by more than 40 percentage points. (In fact, two of the companies mentioned above, Starbucks and Yahoo!, are active recommendations.) If you'd like to see all of our picks, including David and Tom's top stocks for new money, we're offering a free 30-day trial.

Fool contributor Jim Mueller likes the movie Mr. & Mrs. Smith, in which a similar stock discussion scene played out, but he keeps his money in the market, not the backyard. He owns shares of Starbucks and Intel, while his wife owns shares of Microsoft. Intel and Microsoft are Motley Fool Inside Value recommendations. The Motley Fool's disclosure policy couldn't care less about the daily gyrations of the market's movements, plodding its own boring way forward.