How would you like to score a gain of 50.86% on your investment in under two days – without resorting to options or other risky derivatives?

That’s the reward reaped Wednesday and Thursday by shareholders in Mellanox Technologies Ltd. (Nasdaq: MLNX) who were smart enough to either initiate or hold their positions heading into Wednesday’s after-market release of quarterly earnings – earnings that came in so far above analysts’ expectations the stock gapped upward by $26.33 at Thursday’s opening.

By the end of the day, MLNX had advanced to $93.90 a share, up $31.66, or 50.86%, from Tuesday’s closing price of $62.24.

So, how did shareholders and potential investors know the Israeli chipmaker was likely to post such surprising earnings numbers, sending the stock soaring?

How could they have foreseen the company would report revenues of $133.5 million for the quarter, up 111% from a year ago, and profits of $42.9 million, or 99 cents a share, nearly double the last quarterly performance and quadruple year-ago numbers?

After all, analysts who follow the company were expecting earnings of just 73 cents a share, and projecting a meager one-year stock-price target of just $71.33.

Couple that with repeated news headlines shouting how bad things are on the Continent, assertions that the United Kingdom and much of Europe are already in recession, growing evidence the U.S. economy is going nowhere and Fed Chairman Ben Bernanke’s refusals to unleash a third round of quantitative easing (QE3), and it can be psychologically difficult to hold onto a position in the face of a possibly poor earnings report.

However, those who’d been following MLNX via our reports knew there were an equal number of reasons to expect good things from both the company and the stock.

For starters, MLNX recently pulled back to its 50-day moving average, but held above it on higher-than-average volume.

That technical action verified several references we’ve made regarding MLNX being actionable on the long side, based on a number of “pocket pivots.” (Click this link to our archives to see why we saw an entry point each time: http://www.virtueofselfishinvesting.com/reports).

It also kept readers who used our 7-week rule (see http://www.virtueofselfishinvesting.com/faqs for more information) in their positions since their sell stops weren’t violated. Those stops were set just below the 50-day moving average back on June 22 when MLNX penetrated its 10-day moving average. (Note: With the 7-week rule, a stop is triggered only when a stock closes below the low of its 10-day moving average, then moves below that low.)

Stops based on the 7-week rule are far more effective than the 7% to 8% stops employed by most investors, who typically set them based on their purchase price and their risk-tolerance levels. This frequently results in the investor getting “whip-sawed” since, as a winning stock climbs, it will almost certainly experience corrections larger than 7% to 8%.

Such corrections aren’t bad so long as the stock’s price/volume action continues to behave constructively, and the 7-week rule allows investors to ride out such swings and ultimately capture the “fat” part of the stock’s price increase. By contrast, those who used a fixed-stop are usually long gone.

That said, it’s still tough to resist the urge to sell when a stock like MLNX tests its 50-day moving average on higher-than-usual volume.

What helps ease the concerns is the fact that, if you bought at most of our suggested entry points, the pullback by M LNX to its 50-day average still left its price at or above your purchase point. Thus, had it been triggered, the stop loss wouldn’t have resulted in a loss at all.

Now, of course, the question given MLNX’s gap opening on Thursday is, when do we sell the stock – or do we continue to hold?

After the gap opening at $92.71, some initial profit taking carried it down to $89.01, but it then traded higher most of the day, reaching $96.50 before easing back to close at $93.90.

Usually, we set our stop just below the low of the gap-up day – which in this case would be about $88.90 – but we sometimes give a stock an added 2% or 3% below the low, especially if a stock has a history a holding past gap levels.

[INSET MLNX STOCK CHART HERE]

That’s been the case with MLNX, which as you can see from the above chart, made a smaller gap up on April 19. The stock then traded constructively sideways for several weeks before giving a pocket-pivot entry point on June 6. A number of additional pocket-pivot entry points then followed, all of which we reported to VirtueofSelfishInvesting.com members in real time.

If you missed the profits on MLNX’s surprise gap up, don’t fret. Earnings season comes along every three months and you’ll get plenty of chances for future gains. To help in deciding whether to buy or hold a stock heading into a scheduled earnings report, just ask yourself these questions:

1. What is my average cost in the stock?

2. Assuming it is the day before earnings are released, is the stock trading above my average cost? In other words, do I have profit cushion to help me withstand a gap down in the stock price should the earnings disappoint?

3. In a worst-case situation – i.e., the unlikely event the stock gaps down 50% on bad earnings – should I reduce my position size so the loss won’t irreparably harm my trading psychology or excessively impact my capital balance.

4. Should the stock gap higher on a positive earnings surprise, do I have the desire and the capital to add to my existing position if the opening qualifies as a buyable gap up (see http://www.virtueofselfishinvesting.com/faqs for more information on buyable gap ups).

5. Is the stock giving clues the day before it’s due to report earnings? If price and volume are up strongly, it can be a clue that the report will be strong. Likewise, if price and volume are down sharply, that can be a clue the report will disappoint. Be aware, however, that such price/volume actions are no guarantee.

Finally, always ask yourself this series of general questions:

6. What is my overall portfolio exposure to the market? Am I overly concentrated in any one sector? (Over-concentration can work very well in a trending environment with a leading group, but can be dangerous when markets turn.) Should I reduce or increase my market exposure? If the general market gaps down on some bad news out of left field – and it seems these days left field is crowding out centerfield and right field – how should I best reduce my portfolio exposure? What are my weakest stocks?

Note: All stocks under consideration at VirtueofSelfishInvesting.com must display sound fundamental and technical characteristics before we will consider them actionable.

Gil Morales and Dr. Chris Kacher are both Managing Directors of MoKa Investors, LLC, and co-authors of the new book, “Trade Like An O’Neil Disciple: How We Made 18,000% in the Stock Market” (Wiley, 2010). (Add disclosure statement here if needed.)

VirtueofSelfishInvesting.com