Given the stock market's roller-coaster ride over the past two years, you may find yourself struggling about what to do with your investments. With all of the pain you suffered during 2008, you might have been tempted to take your profits and cash out. On the other hand, if you took advantage of the drops to load up on some stock bargains, you've gotten big rewards from the rally.

Time and time again, though, the best way to handle the ups and downs of the markets has been to come up with an investing plan that spreads your money across various types of stocks and other investments -- and then stick with that plan through thick and thin. Too often, giving in to emotional responses can spell disaster for your portfolio. How many times have you succumbed to panic and hit the sell button on a mutual fund, only to discover that you sold at exactly the wrong time?

What could have been
When the markets are gyrating wildly, it's too easy to play the what-if game. Sure, if you had sold your entire portfolio in 2007 and bought some index put options early last fall, you'd have made a killing. If you'd anticipated how dire the situation for Citigroup (NYSE:C) and AIG (NYSE:AIG) would become, you could've gotten out before the worst damage was done.

The problem is that unless you have perfect foresight, you'll never know exactly when stocks will rise or fall. Even experts were too early in trying to pick up bargains among financial stocks. But on the other hand, if stocks start recovering after you sell, you can miss out on substantial gains -- and risky put-option strategies can make you lose your shirt.

Many right answers
The discipline to stick with your investment strategy is more important than exactly what mix of stocks you choose to buy. If you're a proponent of passive investing, then stock index funds such as international phenom Vanguard Emerging Markets Stock ETF (NYSE:VWO) or small-cap index tracker iShares Russell 2000 ETF (NYSE:IWM) might be the cheapest way for you to get exactly the exposure you want. If you prefer individual stocks with good dividend yields, then companies such as PepsiCo (NYSE:PEP), Chevron (NYSE:CVX), or Genuine Parts (NYSE:GPC) might catch your eye.

But the worst thing to do in response to a drop in stock prices -- or a subsequent run-up -- is to give up on your strategy. Of course, if your portfolio's value is dropping when the rest of the market is going up, then you might want to take a closer look to see whether there's something wrong with your methodology. When everyone's losing money, however, you should probably expect to suffer some losses of your own. Panic selling can lock in losses that might have been only temporary.

Because acting rationally is tough in the face of market uncertainty, the best investment strategies have built-in guidelines for both buying and selling. That way, if your financial plan is sensitive to market movements, you always know how to respond to changing stock prices. Yet even if you don't have a specific selling strategy, the best move for money you don't need right away is often not to move a muscle. Not clicking that sell button can save you a lot of regret later.

Recent stock volatility is a valuable reminder that ups and downs are all part of investing. While the risk of declining share prices is always there, history has shown that you can reach your goals over the long term by remaining courageous in the face of apparent danger.

Related articles: