Four years ago, I wrote an article called, "Gold and Stocks: A Prediction and a Challenge." It was a response to a Gallup survey I found astounding: Asked what would be the best long-term investment, 35% of Americans said gold.

That was an all-time high. Only 17% said stocks. That was an all-time low.

My prediction, based solely on that survey, was that stocks would do better than normal going forward, and gold would do worse than normal. My challenge to readers was to find one case in history where any asset, given such huge skews in public sentiment, didn't do the same.

Here's what's happened since:

There's a long history of markets going the opposite direction of popular opinion. It usually happens at extremes, like stocks in 2000, real estate in 2007, or gold in 2011. And the exact timing is never certain. But if you're going to try to predict what markets will do next, you can do worse than betting against the masses -- especially when the masses line up in unison.

Capitalism doesn't favor groupthink. It can tolerate it for a while, but just barely. When large groups of people start marching in the same direction, disappointment isn't far behind. 

There's a takeaway here that doesn't have anything to do with forecasting: Good investing hurts.

"In investing, what is comfortable is rarely profitable," investor Rob Arnott says.

People wanted little to do with stocks in 2011 because they had just suffered one of the worst decades in history. Our extrapolating brains took it from there, and pain of the recent past gave the impression of perpetual doom.

Gold sat in the opposite position. It was enjoying a 10-year boom, which gave off a warm feeling of stability and wealth.

Both of those feelings are equally dangerous. What feels the worst today tends to do the best tomorrow, and vice versa. 

There's going to come a time when Americans are infatuated with stocks again. I don't think we're there yet, but it's going to happen. Investors will realize how much money they've made from the bull market, their friends will get jealous and jump in, and the relentless snowball of stupidity starts rolling.

It's exactly what gold did a few years ago. And it's so important that when we get there -- that moment when you've never been so certain that stocks are the surest path to easy riches -- you fight those feelings, temper your expectations, and have a portfolio that can survive a deep decline.

A few weeks ago, I asked a group of investors to summarize their investment philosophy in 10 words. Mine was, "Worry only when you think you have it figured out." That would have saved goldbugs some pain four years ago. And it will save stock investors some pain the next time they forecast boundless returns. 

For more: