By Matt Badiali

Imagine if Kellogg, the iconic cereal maker, just disappeared. That’s $25 billion suddenly gone… poof.

That’s essentially what just happened in the oil industry. Seven oil companies – Magnum Hunter Resources, Linn Energy, Penn Virginia, Breitburn Energy Partners, SandRidge Energy, Swift Energy, and Halcón Resources – destroyed about $24.5 billion in market value in just about 18 months.

And that’s only a small slice of the oil industry’s pain. More than 70 oil and gas companies have declared bankruptcy since the beginning of 2015. Several of the biggest names filed in the last few weeks. In total, almost $52 billion in debt had to be restructured since 2015. That’s only about 15% of all the debt issued to oil and gas companies…

Moreover, that number is growing almost daily. In the first half of May, eight companies filed for bankruptcy. Combined, the restructured debt totaled $17.7 billion.

However, it isn’t just the debt. Companies have destroyed their asset value as well. They’re writing off billions of dollars. Many of them paid too much for their assets. The prices were based on the assumption that oil couldn’t fall. If you buy oil production that is profitable above $80 per barrel and the oil price falls to $25 per barrel… your acquisition is worth a whole lot less than you paid for it.

Big independent explorer Apache has destroyed 71% of its asset value in the past three years… down from $61.3 billion in 2013 to $17.7 billion in the first quarter of 2016.

The 84 largest oil producers (by volume) listed in the U.S. shed a mind-boggling $179 billion in assets since 2013. That’s more money than 20 states make in a year. It’s more than the gross domestic product of Rhode Island, Delaware, and Alaska combined.

Here’s a table of the largest offenders:

As you can see, the oil and gas landscape is changing rapidly. If you took on debt, overpaid for assets, and outspent your revenue, you are done… toast… caput.

Here’s the thing… We’re beginning to see a handful of “good” companies emerge from the crisis. These businesses continue to improve their balance sheets and cut costs quarter after quarter, and their share prices are rising as a result.

Take Continental Resources, for example. This company was “King of the Bakken” during the shale boom. Its CEO, Harold Hamm, is featured in the book The Frackers. Its shares plummeted as oil prices bottomed earlier this year. But today, they’re soaring… Take a look:

Continental’s stock soared 163%, from a low of $16 per share in January to nearly $42 today. Exploration and production company EOG Resources is up 35%. Even ExxonMobil shares are up 31% from their recent lows.

Don’t get me wrong, none of these companies are solvent if oil prices stay at $25 per barrel… or $35 per barrel. But they did the things necessary to survive low oil prices. You can compare it to a two-income family after the husband loses his job.

There are some families that, even with extreme cuts, have too much debt. Mom’s salary can’t cover the interest payments. Unless Dad finds a job immediately, they are going to go bankrupt.

Other families have two choices. They can assume Dad will find another job right away and just keep on living as usual… or they can cancel the vacation, quit eating out, and save money.

It works the same for all these natural resource companies. Longtime readers will remember the similarities with gold miners. But it can be any company that sells a commodity…

If you borrow too much and spend too much, falling commodity prices will kill your company.

What’s left are the more conservative companies. They didn’t overspend during the good times. They cut costs and sold assets on the way down. And as oil prices head to $50 per barrel, these are the companies that will benefit.

That’s why now is the time to get back in. We want to own the great companies while they are still cheap. We want to be in as the market goes from “bad” to “less bad.”

Let me show you another reason it’s time to buy…

The chart below shows the Thomson Reuters Datastream Oil and Gas Index. It’s made up of 78 companies from all parts of the oil industry, including explorers, pipelines, refiners, and service companies… Companies from ExxonMobil to Williams Partners to Halliburton are on this list.

After peaking in 2014, the index bottomed earlier this year. It’s now up 29% since its low in January 2016. Most importantly, it just broke out to the upside of an important “trend” indicator (red line). Take a look…

The red line is called the “10-month moving average.” It’s the average monthly closing price for these stocks over the last 10 months. Here’s how it works:

When the black line is above the red line, you want to own oil and gas stocks. When the black line is below the red line, you want to be out of oil and gas stocks.

As you can see, the two lines crossed recently, which signals that the oil sector is coming out of its bear market.

That’s it. You don’t need to know anything about “the fundamentals” of these companies, or “supply/demand” equations.

This is important because economic data is usually months old by the time you get it. Gathering the details of the oil market is slow. For example, the latest available production data is from March 2016. Consumption data lags even more. This indicator is simply the best way to gauge the bottom of the market.

And right now, it’s telling us that the bottom is in for oil stocks.