There are some good reasons for cashing in an investment. Image source: Getty Images.

Here at The Motley Fool, we have a long-term mentality when it comes to buying stocks. However, that doesn't mean we hang on to every stock we buy, no matter what. There are a bunch of good reasons to sell stocks, and some that aren't so good. Here are some good and bad reasons to sell, courtesy of our contributors.

Consider selling when your original investing thesis is busted

Brian Feroldi: I've become a firm believer that you should always write down your rationale for buying a stock before you actually pull the trigger. Doing so will allow you to compare how the company is performing against your original expectations and make it easier to decide to sell if the investment veers off track.

As an example of this process in action, I'm currently mulling over the decision to sell my shares in RPX Corporation (RPXC), because the company's recent results haven't lived up to my original expectations.

When RPX first hit the public markets in 2011, it had a very exciting story to tell. The company had pioneered a unique business model that provided patent protection services to other business under a subscription-based model. The company was young, but it was growing rapidly, and it had already courted a number of high-profile tech companies as early clients. Since the number of patent trolls continues to grow, I figured this company was primed for years of highly profitable growth ahead.

Unfortunately, RPX's results have come up short of my original expectations. Revenue has grown at a decent rate since the IPO, but at a much slower rate than I was expecting. In addition, the company's net income hasn't kept pace at all; it actually fell last quarter by 19%. That's not exactly encouraging. 

RPXC Revenue (TTM) Chart

RPXC Revenue (TTM) data by YCharts.

However, the biggest offense of all, in my book, is that it spent $232 million -- a huge amount of money for a $585 million company -- to acquire Investus Solutions earlier this year. Investus specializes in using technology to make the process of legal discovery easier, which sounds promising, but it was a huge bet for the company, and it completely changed my original investing thesis for RPX.  

Wall Street hated the purchase and has greatly punished the stock, and even though I'm down on my purchase, I'm strongly considering selling my shares because my original thesis for owning RPX has so far been busted.

Sell if there's a takeover pending

Matt Frankel: There are plenty of valid reasons to sell stocks, and one example is when a company receives or accepts a takeover offer, especially at a hefty premium.

A great example is the recently announced acquisition of LinkedIn (LNKD.DL) by Microsoft (MSFT 1.65%) for $196 per share, a 50% premium to LinkedIn's closing price the day before the announcement.

LNKD Chart

LNKD data by YCharts.

This is a big win for LinkedIn shareholders, but the problem after the announcement is that there's simply not enough upside potential to justify holding the stock. In this case, LinkedIn's share price shot up to about $191 immediately after the acquisition was announced in June, and the deal is expected to be finalized by the end of 2016.

In other words, by holding LinkedIn shares through the completion of the deal, the best you can hope for is a 2.6% return in about six months. While a sure thing is nice, in situations like this, you can put your investment dollars to better use elsewhere. If you have shares of LinkedIn, or any other company that has a buyout pending, you may want to seriously consider taking your profits and moving on.

Don't sell because you think you have to do something

Jason Hall: One of the most common mistakes investors make is acting because they think they have to. Two common examples:

  • Selling just because a stock has gone up.
  • Selling just because a stock has gone down.

Here's how both of these actions can be a mistake, using Amazon.com, Inc. (AMZN 1.30%) as a recent example. Let's say you bought shares of Amazon at the beginning of 2014. By May of that year, Amazon's stock price was down 28%, and it would finish 2014 down 22%, while the S&P 500 gained over 12%:

AMZN Chart

AMZN data by YCharts.

But if you'd sold your Amazon shares at the end of the year, afraid of more losses -- after all, shares were still over $300 and considered overvalued by many -- you would have missed out on an incredible year to own Amazon stock:

AMZN Chart

AMZN data by YCharts.

Amazon's stock gained 120% in 2015 as the company continued to grow its business in multiple ways. And as you can see in the chart above, your original investment would be up 70% after a couple of years. Time to get out while you're ahead, right? 

Not so fast:

AMZN Chart

AMZN data by YCharts.

So far this year, Amazon's shares are up big again on strong growth and increasing profits.

But the bottom line is this: Sometimes you may sell a stock that's gone up or down, but make sure you're acting with your long-term goals in mind, and considering the prospects of the company you own, not just the stock price. After all, selling for those reasons alone is a surefire way to sell off your best stocks way too soon. 

Don't let your emotions get the best of you

Dan Caplinger: One mistake many investors make is to sell their stock in knee-jerk fashion right after an adverse news event comes out. Most of the time, the stock has already seen its share price fall dramatically following the news, and investors make the mistake of letting their short-term emotions get the better of them. That makes them forget their long-term reasons for owning the stock, and it can often lead to regret when the stock rebounds.

One recent example involves Corrections Corp. of America (CXW 1.27%), which at one point lost more than half of its value after the U.S. Justice Department announced it planned to stop using private prisons to house federal inmates in the future. The flurry of selling convinced many investors that holding onto their shares was a lost cause. Yet by the end of the trading day, the stock had climbed almost 30% from those lows, as rational investors realized that it would take years for federal officials to find alternatives to private prisons, and that the company might find ways to win back lost business.

When the stock has already dropped, it's typically too late to sell. The smarter move is to look calmly at the new situation for the company and see if the fundamental story has changed. Only if your entire investing thesis is wrecked does it make sense to sell quickly.