2012 has been kind to investors. The S&P 500 is up nearly 7% since the beginning of the year, equaling the gain that some forecasters believed would take a year to achieve. Many think the market will continue to rise during the first quarter of 2012, but for those who consider themselves short- to medium-term traders, they know that the market has a way of taking back what it gives so freely, virtually overnight.

This is why investors are happy to see the market rise, but they know that they can't get complacent. When the market continues to go up, what should an investor or trader do to both protect their gains but not lose out on further upside? Here are a few ideas.

SEE: Digging Deeper Into Bull And Bear Markets

Trailing Stops
When a trade is working and money is being made, the trailing stop is one of the best tools the trader can use. As the price of a stock rises, the trailing stop is automatically adjusted to stay a certain distance below the current price. Let's assume that you want to sell your $30 stock if it falls 2% from its current level. If you set a regular stop order at 2% below the current price or $29.40, the stock would remain at $29.40 even as the stock goes higher. A trailing stop would remain at 2% below the stock as it rose. It wouldn't adjust when the stock price falls so you're sure that your maximum loss would always be 2% below the highest price.

Reverse Dollar Cost Averaging
It's impossible to time the market, so trying to find the top of an upward move in order to sell your entire position will likely be a losing strategy. Instead, when you believe your stock is near the top of its upward move, sell a portion of your position. If it continues to move higher, sell another portion at a certain price. Don't be an all-or-nothing investor. You'll likely make less money than if you dollar cost average as a seller as well as a buyer.

Adjust Your Weighting
Professional investors are rarely 100% long in their investments. By using inverse ETFs like ProShares UltraShort S&P500 (SDS), shorting of stock, currency trades and other "short" trades, investors are able to protect themselves as the market rises. Some investors may call this "fading the rally."

Even in the best of markets, short or medium term traders are rarely 100% long the market and as the market goes higher, they may reduce their long exposure to less than 70%. Every trader has different strategies but as the market rises, consider changing your weighting. Selling stock can trigger hefty tax penalties, so opening short positions against your current stock may be a more tax advantageous strategy.

Put Options
When the market moves up, the price of hedging gets increasingly cheaper. Remember that $30 stock you owned? Purchase a put option at a strike price below the stock's current price to insure your losses. If you purchase a $29 put option, you can purchase 100 shares at $29 if the stock goes below the $29 strike price. This insures the stock position you already own, making the maximum loss $29 and possibly an appreciable gain on your put option if the stock continues to drop in value. The best thing about a put option is that it's cheap insurance and as the market rises, put options generally get cheaper.

Increase Your Cash
Don't be greedy. If you've made a lot of money as the market has gone up, don't feel bad about taking your profits. It's always better to make a little less money instead of losing a lot when the market decides to go down. Increasing your cash will set you up to repurchase at discount prices once the market does correct.

The Bottom Line
It's easy to believe that the market will continue to rise but if history is a guide, mean reversion will eventually kick in and the market will correct. If you're a trader, be ready for the mean reversion by protecting yourself. If you're a long term investor, don't react to the short-term corrections – stay invested and buy when the market is once again value priced.

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.