With stocks approaching a new all-time high, an entirely predictable theme is playing out: Analysts who thought the S&P 500 (SNPINDEX: ^GSPC) was full of risks when it traded at 800 are now convinced it's a great buy at 1,500. Investors who thought the market was too dangerous to buy at nine times earnings are now sure it's full of opportunities at 15 times earnings.

Guys, you're doing it wrong.

This happens every market cycle and, no matter how often people vow to avoid looking like lemmings, they fall for the same trap again and again, loathing stocks when they offer big opportunity, and loving them when they offer significantly less opportunity.

"Is a New Bull Market Here?" Barron's asked last week, ironically, a day after stocks hit five-year highs, and almost four years after the start of one of the biggest bull markets in history.

This is precisely why so many investors fail. They wait until after stocks have doubled before wondering whether they're about to rise, and wait until they've crashed before asking whether they're set to fall."Small investors are jumping back into the stock market after abandoning it during the financial crisis," wrote the Wall Street Journal on Monday. "Investors pour record $55 billion into US stock funds in January," writes Reuters. With stocks at five-year highs, this is possibly the worst timing you can think of.

Granted, there's little evidence that investors are overweight stocks, or have irrational expectations about their future. Investors added a net nothing to equities over the last five years, so even record January inflows aren't a sign of wild exuberance. And I don't think it's wrong to be buying stocks at today's prices. They likely offer the best future returns. If you're investing for the long haul, they're where you want to be.

But the amount of missed opportunity left on the table over the last five years has been extraordinary. During bull markets, most investors like to think they're contrarians, touting Warren Buffett's famous mantra of "be greedy when others are fearful, and fearful when others are greedy." But then a market crash hits, and most people realize that they are the "others" Warren is talking about.

What can we learn from all of this? If you pulled money out of stocks in recent years because you thought they were too risky, and now want to jump back in, calculate how much money you left on the table in lost opportunity. Is that amount worth whatever sense of safety you gained from sitting on the sidelines? Maybe it was. If so, great!

If not, know that we will have more bear markets in the future. More crashes, panics, and recessions. They happen more frequently than we pretend. When the next one hits, will you sell after a crash and buy back after shares recover, doing it all wrong? Or will you take a longer view, stay the course, equate cheap stocks with future gains, and have the last laugh when a recovery takes hold?

It's up to you. Don't let the lessons from a crisis go to waste.

The Motley Fool's chief investment officer has selected his number one stock for the next year. Just click here to access the report and find out the name of this under-the-radar company.

Comments from our Foolish Readers

Help us keep this a respectfully Foolish area! This is a place for our readers to discuss, debate, and learn more about the Foolish investing topic you read about above. Help us keep it clean and safe. If you believe a comment is abusive or otherwise violates our Fool's Rules, please report it via the Report this Comment icon found on every comment.

Awww Morgan... I wish you hadn't published this. I was really counting on Big Dumb Money assisted by little dumb money to get us back to sanity with no more recession and make an early end to the secular Bear Market. Now you went and ruined it all My only hope is few people will read it and fewer still will heed it. Bubble moving from Bonds to Stocks could be healthy.....if you like guaranteed to fail paradigms

I've made several of the mistakes you warn about. On the plus side, I invest regularly and did so throughout the above timeframe when people fled equities. On the downside, I overloaded the S&P cap weighted index, and fear rotating into bonds exactly as rates rise and risk of losing principal is real.

So what's the curve on cash? I'm trying to do the math on guaranteed 2.5% return with .25% expenses for next five years vs possible loss of capital in bonds, continued overweight in S&P, or inflation. I was trying to graph best case/worst case and probability of each. Maybe I'll stick with guessing.

Sure, and sorry for the confusion. It's the average annual returns you would have earned if you bought in that corresponding year and held through today. So, if you bought stocks in 2000, you would have since earned -0.3% a year through January 2013. If you bought stocks in 2009, you would have since earned 14% a year.

The purpose of the chart is to show that people love stocks (in 2000) when they offer the least opportunity, and hate them (in 2009) when they offer the most.

Part of the problem is all the books and media out there. They're always saying negative things about the stock market and economy when the stock market is in crash mode. It's scary for the average investor. My Physical Therapist was telling me how he's all in silver and gold because of a book he read. The author claims the stock market is crashing 90% and staying there for a very long time. I personally don't believe it but he does.

I don't get it. Since 2006 my and the spouse's net worth is up about 50%. (Actually, 47.04%).

So what are we doing wrong? We didn't listen to Cramer and sell everything on Oct 6, 2008. We don't consider investing to be entertainment. We don't listen to the talking heads. We don't listen to the politicians. We live below our means, we have no debt - zero; we own our cars, our home and we pay off all credit cards each month.

We invest to make money. We subscribe to Fool services to get information we don't necessarily have the time to do on our own. But before we commit any of our money we "check it out" and make our own assessment. Ditto for the decision to sell

Black Swans? Yes, they are out there. But I never confuse a lack of responsibility on my part for serendipitous events.

Now the question isn't whether you'll buy when stocks are cheap but are you going to sell in the next crash? We're still in a secular bear market according to history. If you look at the Dow chart for the past 100 years, you'll see the average bear market lasted at least 17-19 years. We're only in year 13 right now. I would expect some kind of crash when Obama's second term starts to end in the next couple years.

^ Bear hunting can be risky business... some days you get the bear and some days the bear gets you-ha. But to be more serious, predicting the end of the secular bear is a grand spectator sport best enjoyed as a SPECTATOR rather than a predictor. I've heard various and sundry methods used including years in, chart formations, P/E etc etc. I've noticed none of them work until they do, which tells me their value looking forward is nil, because they are wrong so often and made so compellingly and looking backward (when the bear ends) is less than nil- you don't gain any valuable intelligence and it makes you feel bad to boot.

NOW BEAR FISHING is an entirely different and sporting proposition. Yes its dangerous, risky, but if you follow prudent methods, fishing in Bear Country can put some fat lunkers into your net.

The real question for me is should I be investing more money in the market right now. Like many small investors, I tend to put a little towards my accounts every paycheck or so. But all these news articles about "New Highs" spook me. So I tend to invest less when the market is jumping up.

On the other hand, I've read all the articles about "the best time to invest is now," and how you're almost always better off investing whenever you can.

Very good article, Morgan. It makes a lot of sense and is logical. The problem is that people (including me) panic: when the market falls a lot, we panic that we will lose most of our investment; when the market rises to new highs, we panic because we are being left out of the gains and have to get in as soon as possible). Good job, Morgan. You've given me a lot to think about.

Us poor chaps, middle and working class folks, can't double down when the manure hits the fan. We are dealing with job losses, under-water homes, pay cuts, the whole nine yards. We have to get more conservative with our investments in times like 2008 precisely our time-horizon for needing the money has moved way up (and may have come!), and our risk tolerance gone to nearly zero.

In contrast, the plutocracy has nothing to worry about. The lights are going to stay on, the mortage paid, and their bellies full. They are gambling with Other Peoples' Money anyway. THEY can afford to go big and long, and clean house as a result.

For this reason, the market is a sucker's game for us small folk. We can only afford to play when the money has already been made.

Fair enough, and I don't wish to belittle anyone's financial problems. But part of the reason many didn't have any extra capital to deploy in 2008 when the manure hit the fan is because they invested all or most of their savings near the top during the boom. It's not so much about the amount of savings, but the timing of the deployment of that savings, that causes poor investment results.

Thankfully, sheeple remain sheeple. And I continue to buy when everyone is not. Given the state of affairs, sounds like time to sell may be soon. The principles of Buffett will never die ---- and most people will never learn from them.