To most investors, the sight of less than $50 per barrel of oil has been enough to call it a day when it comes to energy stocks. With a few small exceptions, just about any company that produces oil, natural gas, or coal has struggled to wring out profits from today's market. Just because producers have struggled, it doesn't mean that you need to be headed for the hills. In fact, there are a few companies that can profit in $50 oil, or any oil price for that matter. Let's take a look at why oil prices don't have to be the end for your portfolio and what you need to look for

Supply & demand are closer than you think
In a little more than a year, the price of oil has declined more than 50% based on the idea that the world is swimming in excess supply of oil. To see that glut clear, we are going to need to see either a major pickup in demand or a slowing or potential decline in oil prices. Well, at least that is market narrative today. According to the International Energy Agency, global production of oil was 1.6 million barrels per day more than current demand. That may sound like a lot, but it's actually only 1.7% more than the 95.3 million barrels per day we consume globally. 

That rather small amount of excess supply has been the driving force behind the massive sell-off in oil prices and energy stocks. So far this year, the US Energy Information Administration estimates that US production, the one place around the world that has potentially seen the steepest decline, total production is off about 275,000 barrels per day, a little under 3%. There is a valuable lesson in these numbers. While the price of oil can swing wildly, there is little change in the physical flow of oil & gas during both booms & busts.

Applying that theme to the investing world, a business model where a company' success is tied to the volume of oil and gas, but cares less about the price of the stuff, is likely to be one that will do relatively well in today's market. That is where we find the midstream and pipeline companies of the world. These are the companies that focus almost solely on the transportation, storage, and logistics of oil, gas, and refined product from the first mile of the well head to the distribution centers for consumption. 

Finding that isolated energy company
To be fair, it's extremely hard to find a company that is 100% isolated from commodity prices. Sometimes these midstream companies will charge a percentage of profit on the commodity, which like prices can change over time. For the most part, though, midstream companies will move products based on fixed fee contracts. When looking for a pipeline company in which to invest, this is one of the things you should look for: A high percentage of fixed-fee contracts. 

Let's look at a company to show why this is effective: Magellan Midstream Partners (NYSE:MMP). Magellan is a midstream company that generates a majority of its revenue from the transportation and storage of refined petroleum products such as gasoline and diesel. This company protects its cash flow generating abilities by ensuring that around 85% of its gross operating profits come from fixed fee contractual agreements to use its system. 

Source: Magellan Midstream Partners investor presentation

Thanks to that high level of predictability in cash flow, Magellan's management is able to plan out how it spends that money in advance. This leads to very measured growth plans and leads to a steady increase in dividends for its investors. 

Source: Magellan Midstream Partners investor presentation

Not every company in this space has that much predictability, and some companies use other methods to even out their cash flows such as futures and options contracts. When looking to invest, though, a decent rule of thumb is to look for companies in this space that have more than 75% of their gross profits or revenue coming from fixed fee contracts. Anything less than that, and the cash flows for the company can be compromised in a downturn.

What a Fool Believes
I'll admit that investments in the midstream space are what you would call "defensive" investments. They are going to continue to crank out profits and payouts to shareholders even during the down times like today, but they aren't going to be market crushing stocks when commodity prices are high. What you are buying with companies like this are those that you can rely on to keep churning out cash through thick and thin, and reward you with a high yield payout, which can be pretty lucrative investments when held over the long term.

MMP data by YCharts (Note: Total return is price appreciation plus reinvested dividends)

So if you are getting scared away by the decline in oil and gas prices, maybe its time to start looking at a midstream company for your portfolio.

Tyler Crowe owns shares of Magellan Midstream Partners. You can follow him at Fool.com or on Twitter @TylerCroweFool.

The Motley Fool recommends Magellan Midstream Partners. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.