Investing can be a glorious pastime. You not only learn about companies, industries, and technology, but you also learn more about yourself. Better yet, you can get paid for doing it. But there's a darker side as well: You might lose your hard-earned money.

Here at The Motley Fool, we're generally an upbeat and positive bunch. We like investing, we like writing, and we like writing about investing. Naturally, we tend to tilt toward the positive aspects of investing. But as the resident dark-sider here, I'd like to address what happens when your best-laid plans go up in a puff of smoke, and you find yourself looking at several years of capital loss deductions.

Accept it
The first step in effecting a turnaround is accepting that your portfolio is a mess. Until you're willing to acknowledge that you're losing, you're likely to repeat losing habits.

Of course, "losing" has to be kept in context. While some portfolios are clearly disaster zones, long-term underperformance is more subtle and pernicious. There's no magic number here, but I'd suggest that underperforming the broader market by double digits over a period of at least two years is cause for concern.

Likewise, it's also important to keep your results in context with your goals. Experienced biotech investors, for instance, know they'll have some down years no matter what happens with the market. Or, if you're a conservative income-oriented investor, you might not always beat the averages year upon year. So I'm not talking about a bad year or two here, but a sustained inability to make money in the markets.

Once you realize you have a mess on your hands, take responsibility for it. It's not the fault of naked shorting that you lost money. Nor is it the fault of market makers, analysts, journalists, your family, your dog, or aliens. You made the buy and sell decisions. Malfeasance can wreck a stock or two, but if your whole portfolio is in trouble, the blame begins and ends with the face in your mirror.

Stop and clean out the trash
Once you know there's a problem, stop investing. No, I don't mean pouring your savings into buying collectible tchotchkes or stuffing it in a mattress. I mean you should stop putting new money at risk until you figure out where the old money went. Making a mistake is one thing; continuing a mistake is even worse.

One of the first steps in rehabilitating a portfolio is to make a frank assessment of the stocks you still own. Odds are, if your portfolio is a mess, it's probably because you bought stocks when they were overpriced, or that the conditions of the underlying company deteriorated.

Whatever the case, if a stock isn't carrying its weight, it needs to go. Stocks neither know nor care who owns them. Just because you bought a stock at $30, you're not guaranteed that the stock will see that price again. While it's difficult to be objective about the stocks you own, try to look at them one by one and ask yourself, "Would I buy this stock today if I didn't already own it?" Sure, maybe that portfolio of single-digit midgets will turn around, but it's not likely. For every F5 Networks (NASDAQ:FFIV) or Click Commerce (NASDAQ:CKCM), there are dozens that never make it back.

Do an autopsy
In an ideal world, all of us would keep investing diaries where we jot down our thoughts at the time we buy or sell a stock, along with periodic comments on how we feel about news, valuation, competition, and the like. Like I said, that's the ideal world -- while I have an investing diary, sometimes weeks or months go by between updates.

So assuming you're as bad as I am, try to go through the decisions that led you to underperform. Look at the stocks you bought, the price you paid, and what happened. Did you buy in the heat of "I can't miss out on nanotech" or "I've got to be invested in China"? Did you unwittingly ignore a deteriorating balance sheet or declining earnings quality? Whatever the case may be, try to come up with a few sentences about what went wrong (or right) with each pick and what you might have done differently.

Examine your motives
With luck, your portfolio autopsy has already suggested a few things about your approach or philosophy that could use some improvement. Maybe you're too emotional, or maybe you're too in love with the latest hot thing. Maybe you put all your eggs in one basket -- and picked the wrong basket. Perhaps you pay a bit too much attention to Yahoo! (NASDAQ:YHOO) message boards or TV talking heads and not enough attention to your own due diligence and research.

Ultimately, the fate of your investments depends upon what's between your ears. Successful investing is about building constructive habits and breaking destructive ones, so try to be as candid with yourself as you can. Once you honestly appreciate what you do wrong, you can begin to work around it.

Don't try to make it all back at once
Any veteran poker player will tell you that you can't let a bad play on your last hand lead you into an overly aggressive play on the next. If you try to win everything back all at once, the odds are you'll lose even more. So forget that saucy little biotech, the "next (NASDAQ:AMZN)," or options trading as a one-stop cure-all. Instead, forget about the past -- not the lessons, mind you, but the results.

So what if your portfolio is down 50%? As of right now, you're starting at zero. Make your next decisions with the goal of achieving sustainable and reasonable returns (meaning 7% to 15% a year in most cases) and forget the notion that you somehow have to balance out past losses in the next year or two. Companies like 3M (NYSE:MMM) or Johnson & Johnson (NYSE:JNJ) won't get you rich fast, but they can boost your returns over the long haul, and they shouldn't be ignored just because you feel you have to play catch-up.

Face the harsh light of day
Investors should also accept that there might come a time when it's best to just fold up the tent. Continually losing money defeats the very purpose of savings and investing: building wealth for the future.

So when should somebody pull the plug? This is a difficult question without a one-size-fits-all answer. Generally speaking, though, if you have to go through the aforementioned process more than three times, you might need a more radical solution. Remember, people who couldn't step away from the table built Las Vegas.

If you still have the desire to try individual stock-picking, I'd suggest talking at least half of your remaining cache of cash and stashing it away in quality mutual funds. (A free trial subscription to Motley Fool Champion Funds can help you identify solid candidates.) Then, with what's left over, try to figure out a successful approach to investing -- but don't add any more money to your stock portfolio until you've established a bit of a successful track record. Remember, the markets aren't going anywhere, so there will always be another good time to invest.

Remember -- you can do this!
Losing money is part of investing, but don't let it get you down. An old broker-friend of mine used to say that 95% of all investors had lost money at one time or another, and the other 5% were liars. So don't let a period of poor performance chase you away for good.

The entire purpose of The Motley Fool is to help ordinary individuals invest better. We all make mistakes, but if you're willing to change your habits, you can start building your wealth anew. No matter what mistakes you've made or what shape your portfolio is in, as long as you're willing to try to improve, there's hope ahead.

If you think you could benefit from a few solid investment ideas, check out our full range of Foolish newsletters. From dynamic growth to deep value, the Fool offers a newsletter for every kind of investor.

Fool contributor Stephen Simpson owns shares in Johnson & Johnson. The Fool has a disclosure policy.