Photo: Flickr/Don DeBold.

Here's a rule you can live by: Only buy stock in a specific company if you have reason to believe it will outperform the broader market. Otherwise, just buy an exchange-traded fund that tracks the market, reinvest the dividends, and tell your friends with a clear conscience that your portfolio beats the 90% or more of hedge funds that are currently underperforming the S&P 500 (^GSPC 1.20%).

I hesitate to say that this rule is obvious, because it took me years to appreciate its power. Like those of you who think I'm an idiot right now -- or, as my wife would say, "Captain Obvious" -- I've long been overconfident in my investing prowess. Why should somebody as smart as I am surrender my portfolio's fate to the market?

But the reality is that most investors don't follow it. The data is definitive. The vast majority (and I do mean vast majority) of individual investors dramatically underperform the S&P 500. Over the past two decades, financial analytics firm DALBAR estimates that the broader market has more than doubled the return of the individual investor.

As I see it, there are two explanations -- beyond, of course, the standard behavioral biases that lead us to do dumb things with money. The first is that most investors don't think in terms of opportunity cost. They don't ask themselves: "If I buy Stock A, what am I missing out on by not investing in the overall market?"

While this is a straightforward question, history proves that it's an exacting standard. Over the past 50 years, the S&P 500 notched a compound annual growth rate of 9.75%. And the numbers are even more impressive when you consider the impact over multiyear periods. The median total return of the S&P 500 over all 25-year stretches between 1925 and 2013 is 956%.

My point is that it isn't easy -- and some would say it's impossible -- to contemporaneously identify stocks that will outperform these marks absent sheer luck.

The second explanation is even more pedestrian in nature. That is, people don't know how to invest opportunistically. What does "opportunistic" mean? Does it mean you should buy stocks that you have a gut feeling about? Does it mean you should buy stocks that your neighbor has been going on and on about for months?

The hopefully apparent answer to both of these questions is "no." At the end of the day, opportunistic investing boils down to buying companies that are deeply undervalued because of the irrational behavior of other investors. "An opportunist buys things because they're offered at bargain prices," says Oaktree Capital Management's Howard Marks in The Most Important Thing.

This is the essence of Warren Buffett's advice to be fearful when others are greedy and greedy when others are fearful. Of course, anybody who's tried to stick to this dictate knows that it's much easier said than done. At the very least, you still need a reason to conclude that the stock at issue will outperform the high and less risky bar set by the broader market.

The only other occasion to invest opportunistically is if you believe the underlying company is so exceptionally run -- and, I might add, reasonably priced -- that it can't help beating the market going forward. This is a highly qualitative and involved analysis, but it's critical if you're buying a stock that isn't otherwise patently cheap.

In my own wheelhouse of bank stocks, I think about companies such as US Bancorp (USB -0.20%), Wells Fargo (WFC -0.26%), and M&T Bank (MTB 0.81%), all of which, by the way, are also major holdings of Buffett's Berkshire Hathaway. The leaders of these institutions have proved themselves to be a rare commodity indeed -- namely, prudent and responsible risk managers through the highs and lows of multiple cycles.

If you've read down to this point, then I'd advise you to take three things away from this article. First, it's extremely hard to beat the market. Second, there's absolutely no shame in using a simple strategy of dollar-cost averaging and reinvesting the dividends from a low-cost exchange-traded fund that tracks the S&P 500 as an alternative to buying individual stocks. And third, if you do decide to invest in specific companies, then you should do so in a truly opportunistic manner.