Many investors are drawn to stocks that have performed well, figuring that there's often even more upside to come. As it turns out, though, sometimes buying after good performance can be the worst move you can ever make -- and what may surprise you the most is that the company whose shares have risen so far can itself be to blame.

Chasing performance
Investors have strongly differing opinions about whether it pays to look at stocks that have gone up recently. In one camp are value investors, who argue that stocks whose prices have risen sharply have a lot less margin of safety, relying on ever-increasing successes in their revenue and earnings growth in order to support their ballooning valuations. Eventually, they figure, enough investors will see the light to cause the stock to fall back to more reasonable levels. That's arguably what happened to Netflix (Nasdaq: NFLX) last summer, when shares rose to more than $300 per share before the company first announced it would restructure its pricing plans. The stock lost three-quarters of its value before rebounding.

Meanwhile, momentum investors note that the long trends that many stocks follow are observable and persistent. Moreover, when these stocks do have fundamentals working for them, they can rise much further than value investors give them credit for. Apple (Nasdaq: AAPL) is the obvious example of this phenomenon, as its shares still sport a very reasonable P/E multiple even after soaring over the past several years. The success of its mobile products has only bolstered the momentum play.

Sabotaging their shareholders
Regardless of which side of the argument you take, the worst thing in the world is when the companies you're investing in end up taking the other side of the trade. Unfortunately, that seems to be happening all too often lately.

Yesterday, reports surfaced that Zynga (Nasdaq: ZNGA) was planning to sell additional shares in a secondary offering. The news comes after Facebook's IPO filing vaulted Zynga's stock from depressed levels to well above its offering price. From all appearances, an offering would seem to take advantage of higher prices -- but would potentially add selling pressure to the stock, hurting existing shareholders.

Zynga is far from the only company to take measures like these. Shortly after an FDA panel recommended approval of its obesity drug Qnexa, VIVUS (Nasdaq: VVUS) announced that it would sell 9 million shares in a secondary offering, raising more than $200 million. The move hurt investors who bought in after the FDA announcement, as shares have now slipped almost 20% from their highest levels last month.

Doing offerings right
Sometimes, secondary offerings actually help existing shareholders. For instance, the closed-end fund Central Fund of Canada (AMEX: CEF) holds gold and silver bullion, occasionally offering new shares to raise cash to increase its holdings of precious metals. For the most part, though, Central Fund only does secondary offerings when its share price is above the net asset value of the gold and silver it already owns.

That practice enhances the value of existing shares by effectively charging a big premium to let new investors gain entry to the fund. If all companies followed that practice, then shareholders would be far better off. Yet often, a secondary offering ends up fetching less than the prevailing share price on the open market.

What to do
Whenever you have a stock that has jumped substantially, one question you need to ask is whether the company needs to raise cash. If so, a high share price marks a perfect opportunity for the company to do a secondary offering. That's not always bad news for long-term investors, but it does mean you should watch out if you're thinking about buying near recent highs.

In addition, look back at the history of the stocks you're interested in. If they've done secondary offerings before, they're more likely to take advantage of favorable conditions when they arise again.

High-flying stocks can bring you huge returns, but they are also risky. By knowing the warning signs of when companies are going to dump more shares of their own stock onto the market, you can be sure to get out of the way when it happens.

Over time, the right stocks still deliver the long-term results you need. Be sure to check out The Motley Fool's latest special report on retirement, which highlights three promising stock picks for retirement investors. Don't wait; get your free report today while it's still available.