Corporate insiders sell their own companies' stock for a number of reasons.

They might need the cash for a big personal purchase such as a new house or yacht, or they might need the cash to fund a charity. Sometimes they sell as part of a planned selling program that they have put in place for diversification purposes, which allows them to sell stock in stages instead of selling all at one price.

Other times they sell because they think their stock is overvalued and the risk/reward is no longer attractive. Some even dump their own stock because they have inside knowledge that a competitor is eating their lunch and stealing market share.

But insiders usually buy their own shares for one reason: They think the stock is a bargain and has tremendous upside.

The key word in that last statement is "think." Just because a corporate insider thinks his or her stock is going to trade higher, that doesn't mean it will play out that way. Insiders can have all the conviction in the world that their stock is a buy, but if the market doesn't agree with them, the stock could end up going nowhere. Also, I say "usually" because sometimes insiders are loaned money by the company to buy their own stock. Those loans are often sweetheart deals and shouldn't be viewed as organic insider buying.

Stocks with notable insider activity is something that I tweet about on a regular basis. These are also the exact type of stocks that I love to trade and alert in real-time.

At the end of the day, it's institutional money managers running big mutual funds and hedge funds that drive stock prices, not insiders. That said, many of these savvy stock operators will follow insider buying activity when they agree with the insider that the stock is undervalued and has upside potential. This is why it's so important to always be monitoring insider activity but twice as important to make sure the trend of the stock coincides with the insider buying.

Recently, a number of companies' corporate insiders have bought large amounts of stock. These insiders are finding some value in the market, which warrants a closer look at these stocks.

Western Refining

One energy player that insiders are snapping up a large amount of stock in here is Western Refining  (WNR) , which operates as an independent crude oil refiner and marketer of refined products. Insiders are buying this stock into massive weakness, since shares have fallen by 47.5% over the last six months.

Western Refining has a market cap of $2 billion and an enterprise value of $3.1 billion. This stock trades at a cheap valuation, with a trailing price-to-earnings of 6.5 and a forward price-to-earnings of 10.1. Its estimated growth rate for this year is -59.4%, and for next year it's pegged a 13.1%. This is not a cash-rich company, since the total cash position on its balance sheet is $593.10 million and its total debt is $1.71 billion. This stock currently sports a dividend yield of 7%.

The chairman of the board just bought 500,000 shares, or about $10.80 million worth of stock at $21.53 to $21.65 per share. From a technical perspective, Western Refining is currently trending below both its 50-day and 200-day moving averages, which is bearish. This stock has been uptrending a bit over the last few weeks, with shares moving higher off its low of $20.64 to its intraday high on Wednesday of $23.48 a share. During that uptrend, this stock has been making mostly higher lows and higher highs, which is bullish technical price action. That move has now pushed shares of Western Refining within range of triggering a near-term breakout trade.

If you're bullish on Western Refining, then I would look for long-biased trades as long as this stock is trending above some key near-term support levels at $21.05 to $20.64 a share and then once it breaks out above some near-term overhead resistance levels at $23.09 a share to its 20-day moving average of $24.53 a share with high volume. Look for a sustained move or close above those levels with volume that hits near or above its three-month average volume of 2.83 million shares. If that breakout hits soon, then this stock will set up to re-test or possibly take out its next major overhead resistance levels at its 50-day moving average of $26.64 to $30 a share.

AppFolio

Another stock that insiders are loading up on here is AppFolio  (APPF - Get Report) , which provides industry-specific cloud-based software solutions for small and medium-sized businesses in the property management and legal industries. Insiders are buying this stock into notable weakness, since shares have dropped by 18.7% over the last six months.

AppFolio has a market cap of $439 million and an enterprise value of $413 million. This stock trades at a reasonable valuation, with a price-to-sales of 5.28 and a price-to-book of 6.20. Its estimated growth rate for this year is 44.9%, and for next year it's pegged at 47.4%. This is a cash-rich company, since the total cash position on its balance sheet is $21.22 million and its total debt is zero.

A beneficial owner just bought 345,477 shares, or about $4.38 million worth of stock, at $12.45 to $12.70 per share.

From a technical perspective, AppFolio is currently trending above its 50-day moving average and well below its 200-day moving average, which is neutral trendwise. This stock has been consolidating and trending sideways over the last month and change, with shares moving between $12.07 on the downside and $13.25 on the upside. This stock has recently started to bounce off its 50-day moving average of $12.36 a share, and that bounce is now quickly pushing shares of AppFolio within range of triggering a near-term breakout trade above the upper-end of its recent sideways trending chart pattern.

If you're bullish on AppFolio then I would look for long-biased trades as long as this stock is trending above its 50-day moving average of $12.36 a share or above more near-term support at $12.07 a share and then once it breaks out above some near-term overhead resistance levels at $13.15 to $13.25 a share with high volume. Look for a sustained move or close above those levels with volume that registers near or above its three-month average action of 57,211 shares. If that breakout gets started soon, then this stock will set up to re-test or possibly take out its next major overhead resistance levels at $14.50 to its 200-day moving average of $14.83, or even $15 to $15.50 a share.

Akamai Technologies

One technology player that insiders are jumping into here is Akamai Technologies  (AKAM - Get Report) , which provides cloud services for delivering, optimizing and securing content and business applications over the Internet in the U.S. and internationally. Insiders are buying this stock into notable weakness, since shares have slid lower by 13.6% over the last six months.

Akamai Technologies has a market cap of $9 billion and an enterprise value of $8.7 billion. This stock trades at a fair valuation, with a trailing price-to-earnings of 28.9 and a forward price-to-earnings of 16.7. Its estimated growth rate for this year 6.7%, and for next year it's pegged at 13.4%. This is a cash-rich company, since the total cash position on its balance sheet is $837.87 million and its total debt is $623.48 million.

The CEO just bought 19,497 shares, or about $999,000 worth of stock, at $51.28 per share.

From a technical perspective, Akamai Technologies is currently trending below both its 50-day and 200-day moving averages, which is bearish. This stock has been uptrending a bit over the last few weeks, with shares moving higher off its low of $48.88 to its recent high of $52.03 a share. During that uptrend, shares of Akamai Technologies have been making mostly higher lows and higher highs, which is bullish technical price action. That move has now pushed this stock within range of triggering a near-term breakout trade.

If you're in the bull camp on Akamai Technologies, then I would look for long-biased trades as long as this stock is trending above some near-term support at $50 a share or above that recent low of$48.88 a share and then once it breaks out above some near-term overhead resistance levels at $52 to $52.03 a share and then above its 50-day moving average of $52.88 a share with volume that hits near or above its three-month average action of 2.21 million shares. If that breakout fires off soon, then this stock will set up to re-test or possibly take out its next major overhead resistance levels at $55 to $57.50, or even its 200-day moving average of $58.72 a share.

Intrexon

Another stock that insiders are loading up on here is Intrexon  (XON - Get Report) , which operates in the synthetic biology field in the U.S. Insiders are buying this stock into big weakness, since shares have dropped by 23.4% over the last six months.

Intrexon has a market cap of $3.2 billion and an enterprise value of $2.9 billion. This stock trades at a premium valuation, with a price-to-sales of 17.18 and a price-to-book of 4.71. Its estimated growth rate for this year is -71.1%, and for next year it's pegged at 46.2%. This is a cash-rich company, since the total cash position on its balance sheet is $260.39 million and its total debt is just $9.04 million.

The CEO just bought 41,830 shares, or about $1 million worth of stock, at $23.92 per share.

From a technical perspective, Intrexon is currently trending above both its 50-day and 200-day moving averages, which is bullish. This stock recently formed a double bottom chart pattern, after shares found some buying interest at $23.35 to $22.81 a share. Following that potential bottom, this stock has now started to uptrend and move back above its 20-day moving average of $26.54 a share. That move is starting to push shares of Intrexon within range of triggering a near-term breakout trade above some key overhead resistance levels.

If you're bullish on Intrexon, then I would look for long-biased trades as long as this stock is trending above some near-term support at around $25 a share or above those recent double bottom support levels and then once it breaks out above some near-term overhead resistance levels at $27.36 to $28 a share and then above more resistance levels at $28.50 to $30 a share with high volume. Look for a sustained move or close above those levels with volume that hits near or above its three-month average action of 2.19 million shares. If that breakout materializes soon, then this stock will set up to re-test or possibly take out its next major overhead resistance levels at its 50-day moving average of $32.01 to $34, or even its 200-day moving average of $35.22 a share.

Medicines

My final stock with some large insider buying is health care player Medicines  (MDCO) , which provides medicines for patients in acute and intensive care hospitals worldwide. Insiders are buying this stock into notable weakness, since shares have fallen by 12.6% over the last six months.

Medicines has a market cap of $2.5 billion and an enterprise value of $2.6 billion. This stock trades at a fair valuation, with a price-to-sales of 9.86 and a price-to-book of 3.81. Its estimated growth rate for this year is 9.8%, and for next year it's pegged at 18.1%. This is not a cash-rich company, since the total cash position on its balance sheet is $430.20 million and its total debt is $573.88 million.

A director just bought 300,000 shares, or about $10.10 million worth of stock, at $33.68 per share.

From a technical perspective, Medicines is currently trending above both its 50-day and 200-day moving averages, which is bullish. This stock has been uptrending strong over the last four months and change, with shares moving higher off its low of $27.50 to its recent high of $37.50 a share. During that uptrend, this stock has been making mostly higher lows and higher highs, which is bullish technical price action. That strong trend has now pushed shares of Medicines within range of triggering a big breakout trade.

If you're bullish on Medicines, then I would look for long-biased trades as long as this stock is trending above its 50-day moving average of $33.54 a share and then once it breaks out above some near-term overhead resistance levels at $37 to $37.50 a share and then above more key resistance levels at $37.50 to $38 a share with volume that hits near or above its three-month average action of 786,197 shares. If that breakout takes hold soon, then this stock will set up to re-test or possibly take out its next major overhead resistance levels at $40 to $43, or even $44 a share.

Disclosure: This article is commentary by an independent contributor. At the time of publication, the author held no positions in the stocks mentioned.