Bet against the masses. Don't be the lemming. Be fearful when others are greedy.

Follow these simple rules, and you'll probably be a successful investor.

With those rules of thumb in mind, you'd be forgiven for thinking now is a terrible time to buy stocks. The S&P 500 is up more than 40% since March, which is typically consistent with a market flooded with unrestrained optimism. Sure enough, some investors are preaching of an overvalued market that's gotten way ahead of itself.

Oh really? 
And maybe they're right. But perspective is in order: When stocks bottomed out in early March, a better part of the investment community thought the world was about to explode. Companies like Alcoa (NYSE: AA) and Wells Fargo (NYSE: WFC) traded for trivial valuations because, quite literally, some feared imminent implosions.

Today, it looks like we've skirted most of those calamitous end-of-the-world threats. It's still terrible, mind you, just not as terrible as many thought. Naturally, stocks have sprung back to levels that reflect a deep recession, rather than a total Mad Max scenario.

This is an incredibly important distinction to make: Markets haven't risen to levels that reflect future optimism, but to levels consistent with a world that isn't about to fall into mass insolvency.

This is evident by looking at the biggest winners over the past few months. By and large, the stocks that have risen the most are ones you wouldn't recommend to your worst enemy. Have a look:

Company

3-Month Return

2009 EPS Estimates

Dollar Thrifty Automotive

585%

($1.00)

Avis Budget Group

270%

($0.44)

ArvinMeritor

304%

($1.24)

Data from Yahoo! Finance and Google Finance.

Are these companies destined for greatness? Did they announce a new blockbuster product? Are they the next Microsoft (Nasdaq: MSFT) or Intuitive Surgical (Nasdaq: ISRG), waiting to change the way we live? Goodness, no. Not even close. Their huge gains are simply a reflection that they'll live to see another day.

This is a rally built on canceling out past pessimism, not pricing in future optimism. The biggest gains have been concentrated in very low-quality companies that are simply being given a second shot at life. 

Not all gains are created equal 
The idea that a stock is overvalued after a massive run-up is contingent on the idea that it was properly priced to being with. But this was hardly the case when the market bottomed in March. More importantly, some of the highest-quality companies in the world have largely been left out of the rally and still trade at attractive prices.

Here are three in particular:

Company

3-Month Return

Forward P/E Ratio (FY 2010)

General Electric (NYSE: GE)

1%

14.6

SYSCO (NYSE: SYY)

2%

13.3

Wal-Mart (NYSE: WMT)

(2% )

12.9

What's to like about these three? Glad you asked:  

  • General Electric was humbled and humiliated as its finance arm, GE Capital, erupted with the rest of the financial industry. But what's often overlooked is that GE Capital received a $9.5 billion capital infusion from its parent company, General Electric, earlier this year. That ended up making it one of, if not the, best-capitalized financial institutions alive. Strip back the uproar surrounding GE Capital, and what's underneath is the real General Electric -- a collection of some of the world's best companies trading at a multiple unheard of in years past.
  • Simply put, SYSCO dominates its industry. As the largest food distributor in North America, it has a big leg up on competition with a scalable and efficient supply chain. Shares currently trade at about 13 times earnings. That's nearly half the multiple shares commanded, on average, going back to 1992. Add in a 4.1% dividend, and some might see this as an intriguing opportunity.   
  • Wal-Mart is one of the only companies that can do better in a recession than during boom years. As consumers scale down and pull their hair out in search of bargains, low-cost retailers like Wal-Mart become magnets. In fact, the company produced record net income in 2008. Yet, as its outlook brightened, Wal-Mart's valuation compressed. Today's forward P/E ratio of just over 12 seems quite appealing for a company hell-bent on becoming a universal bargain stop for cash-strapped consumers. 

Onward 
Perspective can be a powerful thing: One year ago, Dow 9,000 would have been associated with the end of the world. Today, some want to treat it like it symbolizes irrational exuberance simply because we've bounced so far off the March lows. This is inherently flawed thinking. Focusing on a stock's percentage change over a short period of time is utterly meaningless. Drilling down on a company's intrinsic value and buying bargains like we haven't seen in decades is what's important.

And that's why our Motley Fool Inside Value team of analysts is having a field day digging through the rubble and finding cheap stocks like never before. If you'd like to see what they're recommending right now, click here to try the service free for 30 days. There's no obligation to subscribe.

Already subscribe to Inside Value? Log in at the top of this page.

This article was published on June 25. It has been updated.

Fool contributor Morgan Housel doesn't own shares in any of the companies mentioned in this article. Intuitive Surgical is a Motley Fool Rule Breakers selection. Microsoft, SYSCO, and Wal-Mart are Inside Value selections. SYSCO is an Income Investor recommendation. The Fool has a disclosure policy.