Insiders have been aggressively selling stocks of late. As my Foolish colleague Tim Beyers pointed out earlier this month, research from TrimTabs indicates that the ratio of insider selling to insider buying is running at 30.6:1, which is the highest number since the firm started tracking the data in 2004. In addition, companies have been record net sellers of stock, to the tune of $105.2 billion over the past four months.

Meanwhile, short interest has fallen dramatically, and margin debt has spiked upward. From a sentiment perspective, there are also signs of extreme optimism just as insiders are selling into the rally: 51.6% of advisors surveyed by Investors Intelligence are bullish, the highest level since December 2007.

So, what should you do?
I know from experience that investors get most bullish near the end of a big run, and most desperate near a bottom. The numbers above confirm that. I didn't think that the economic situation was as bad as the market was projecting it to be in March, and I don't think it's as good as the market is discounting it to be right now. Which brings me to point out the obvious: Investors should avoid the low-quality stocks that have run up the most during the rally and focus instead on established companies that can thrive in the current challenging economic environment.

A different kind of insider selling
To be fair, there are situations where insider selling is not necessarily bearish. I recently came upon an exciting specialty lab company, Genoptix (NASDAQ:GXDX), that had seen strong insider selling since going public in 2007. Genoptix is similar to larger rivals Quest Diagnostics (NYSE:DGX) and LabCorp (NYSE:LH), but it goes a step further by employing specialized doctors who help oncologists and hematologists analyze test results throughout each patient's course of treatment.

The problem was that Genoptix was still majority-owned by venture capital funds that needed to monetize their investment. So even though the company kept delivering great financial results, the VC funds kept selling shares. There was a secondary offering in February 2008 that represented only insiders that brought the insider ownership from 59% to 48%. Still, the remaining overhang has been pressuring the shares ever since, despite the company's being consistently profitable and beating its earnings estimates every quarter. Genoptix is an example of benign insider selling, in my opinion.

Bullish insiders are like needles in a haystack
Because I was curious, I looked at insider purchases and sales over the past several weeks independently. Doing so confirmed the data from TrimTabs: there's way more selling than buying right now. There is insider selling at Kohl's (NYSE:KSS), probably because of the sorry and deteriorating state of the U.S. consumer. Surprisingly, Toll Brothers (NYSE:TOL) has also seen massive selling -- I did not see a single buy transaction since January, which is making me question my thesis that residential housing may be about to turn. Toll Brothers has done well, but why, then, are insiders selling into this rally?

On the other hand, there is insider buying in Starbucks (NASDAQ:SBUX) and Southern Copper (NYSE:PCU) that needs some further investigation. Starbucks is getting "less bad," which is good news in this environment. The company is nearing the end of its cost-cutting, store-closing campaign, which is being taken as a sign that the worst is behind it. Also, since Starbucks is closing fewer stores than it originally forecasted, the investing public is getting excited. Insider buying here is a big positive sign as financial performance numbers have not materially improved yet.

Southern Copper is simply reflecting the performance of copper prices, is up from $1.25 per pound in December to almost $3 per pound currently. The company carries little debt, and analysts expect earnings to improve notably next year. Still, the stock has nearly tripled off the lows, so I would recommend cautiously waiting for a correction to buy in. The insiders, though, are not waiting, which is a bullish sign.

Insider buying and selling in certain stocks doesn't always tell a perfect story. But in the aggregate, it says a lot about the market as a whole. It looks to me that insiders are very skeptical about this rally.

More on market issues: