"As stock markets slid in March, Judy Brady lay awake at night thinking about her portfolio. 'My retired friends who had all CDs and gold, and they were still making money, and my investments just kept going and going,' she said. 'I thought: I can't afford to lose all this.' So the 70-year-old retiree in Schaumburg, Ill., sold most of her stocks."
 -- The Wall Street Journal, May 18, 2009

For 17 long months, the S&P 500 slid; from an Oct. 11, 2007, high of 1576 to its 677-point nadir on March 9, 2009. By that time, this widely watched index of America's 500 biggest and best firms had lost 57% of its value.

Little wonder that Judy Brady panicked, or that so many investors like her could not take the pain anymore, and sold at the bottom. The great wonder is that not everyone did cash out and swear off the stock market for good. And for those who stayed the course, this great wonder has turned into great good fortune.

Since hitting bottom, the S&P 500 has soared 62% in 10 months, leaving those who sold at the bottom lying in the dust.

But how was I to know?
You weren't. You couldn't. Whether you're one of the unfortunates who sold at the actual market bottom, or whether you simply failed to buy at the lows, you shouldn't beat yourself up just because you missed out on one of the stock market's great rallies. In truth, it's just not possible to time the market.

And even if you could time the market, there's no guarantee it would have made a difference. To paraphrase legendary investor Peter Lynch: "There's only one reason to buy a stock (i.e., because you think it will go up), but many reasons you may need to sell." Whether you needed to sell stock to pay medical bills, college tuition, or simply living expenses as the result of an unexpected job loss, no one's going to blame you for cashing out at the bottom.

Or maybe you're on a fixed income, and you depend on your investments to provide a steady flow of funds to live on. The past year has seen many companies we never thought of as "weak" forced to staple their wallets shut. JPMorgan Chase (NYSE: JPM), Wells Fargo (NYSE: WFC), and Macy's (Nasdaq: M) have all slashed dividends to the bone. If you bought a stock in reliance on the dividend it paid, and it then cut that dividend, then you no longer owned what you'd bargained for. It was surely time to sell.

And then there's the best reason of all to sell: You simply weren't comfortable with the investment. If you had too much money at risk in the market -- and then that risk materialized -- then of course you needed to sell! People need to be able to sleep at night. If you had so much of your net worth tied up in stocks that their daily gyrations gave you insomnia, then there's no two ways about it. Those stocks had to go.

So I repeat: Do not beat yourself up about this. The past is past, and the question today is much simpler: What do you do now?

It's not too late
Now that you've lived through the market meltdown, I'll bet you have a much better idea of how much risk you can tolerate. Now it's time to invest up to, but not beyond, that limit. First of all, set aside enough cash to keep you going through at least six months of living expenses, and don't push cash into the market that you're going to need in the next five years. Whatever's left is what you have available for investment. And as you've seen over the last four months, the stock market is the best way to increase the value of your investments.

Here at the Fool, we know this from personal experience. You see, way back when we began recommending stocks to our subscribers, the market was still reeling from the aftershocks of the Great Tech Bubble. We started up Motley Fool Stock Advisor in the teeth of the bear market of '02. But by ignoring the headlines and focusing on buying great companies, the ensuing seven years have us beating the market soundly -- up 48% versus the market's 1% loss.

Consider that while the KO'd stock market has lifted itself up off the mat for a 62% rebound, it's still 30% below its high-water mark. To return to the prices of yesteryear, the S&P will need to rise another 42%. That would suggest there remains plenty of upside.

But how do you know the market will gain back the 42%?
Good point. After all, the highs we hit in 2007 were fueled largely by low-quality profits in the financial sector -- excessive risk-taking at Fannie and Freddie, and excessive stupid-mistake-making at Regions Financial (NYSE: RF), to name a few culprits. Defunct financial houses like Lehman Bros. and Merrill Lynch won't make a comeback, nor contribute a penny toward returning the S&P to its former glory.

But here's the thing: Not all stocks are Regions. Whether or not the overall market surges to its former highs soon, some companies will revive ... and thrive. At the risk of stating the obvious, these are the companies you want to own now.

Companies with great name recognition, like Johnson & Johnson (NYSE: JNJ). Firms with wide, defensible moats around their business, like Altria (NYSE: MO). Innovative tech shops, which continually churn out new products that we never knew we needed, until we couldn't live without 'em. And by the way: Thanks for saving Stern, Sirius (Nasdaq: SIRI)!

These are just some of the qualities we look for when choosing our portfolio at Motley Fool Stock Advisor -- and these are the kinds of stocks we recommend to our members. If you're looking for more stock ideas and would like to take a look at which stocks we're recommending today, simply click here to read about our favorite stocks ideas, free for the next 30 days.

Fool contributor Rich Smith does not own shares in any of the companies named above, but Johnson & Johnson is a Motley Fool Income Investor recommendation.Why do we tell you this? Because you deserve to know, and because we've got a disclosure policy. That's why.