What: U.S. independent oil and natural gas producer Ultra Petroleum Corp. (UPL) stock had a pretty bad month in July, falling 38%. The company's stock has been falling consistently since last summer, and is now down nearly 75% since May 2014:

UPL Chart

UPL data by YCharts

So what: What fueled last month's big drop? In short, it was partly the continued weakness in oil and natural gas prices we've seen over the past year, as well as a couple of analyst downgrades late in July that further accelerated the sell-off. But that's only part of the story. 

Through May 1, Ultra Petroleum's stock was up 35% in 2015, as oil prices had begun to recover and the company reported a relatively well-received quarter. Since then, oil prices have fallen about 23%, while Ultra's stock is down a whopping 60%. Unfortunately, July 30's earnings report -- while better than Wall Street analysts were expecting -- didn't have much effect on the stock. 

Now what: While there aren't any clear indicators that oil prices are set to rebound anytime soon as production continues to contribute to a global oversupply, Ultra is much more dependent on natural gas than on oil, with over 80% of its revenues this year coming from gas sales. Furthermore, the company said in its most recent earnings report that about 85% of its natural gas production for the rest of the year is under hedges at $3.71 per Mcf, which is a significant premium to current market prices

For a little context, the company is projecting total Q3 operating costs per Mcfe between $3.21 and $3.38, giving the company a pretty strong margin of safety for the balance of this year. This isn't an aberration, either; historically, Ultra's management team has consistently used hedges to lock in predictable cash flows. This may limit upside if gas prices move up quickly, but it can mean the difference between growing and going out of business when prices fall. 

In summary, last month's sell-off -- which really started in May -- may continue. Ultra's stock has rebounded lately, but you can rest assured that the price is likely to move around with oil prices in short periods of time. But looking at the bigger picture, this is one of the best-run independent producers, and eventually the market will come back. For long-term minded investors willing to ride out the volatility over the next few months (or maybe longer), now could be a great time to open a position or add a few shares.