The stock market is often shortsighted. Investors tend to focus on the current quarter or what a company has done lately instead of looking out over the bigger picture. Because of that, some stocks get unfairly beaten down relative to their long-term upside potential. 

Three Motley Fool contributors believe that's the case for Magellan Midstream Partners (MMP), Bloom Energy (BE 5.47%), and Brookfield Infrastructure (BIPC 1.18%) (BIP 0.36%). Shares of all three are well off their former peaks, even though they have bright futures. Because of that, these beaten-down stocks look like great buys right now. 

A contrarian bet

Reuben Gregg Brewer (Magellan Midstream Partners): Ask just about anyone today and they'll tell you that the world needs to pivot to clean energy, offering up solar and wind power as the key energy sources of the future. No argument here, but the world just can't switch to clean energy overnight. It will take decades and, in the meantime, the world, particularly developing nations, will still need oil and the products into which it gets turned. If you can see the validity in that argument, then you might want to add 7.9%-yielding master limited partnership (MLP) Magellan Midstream Partners to your portfolio.

The company operates pipelines, storage, and transportation assets for oil and refined products. These midstream energy businesses are largely fee based, so Magellan tends to throw off a fairly steady stream of cash to support its payout. At this point, cash flow covers its distribution by a solid 1.2 times. Backing that up is one of the industry's strongest balance sheets, with a debt-to-earnings before interest, taxes, depreciation, and amortization (EBITDA) ratio that is at the low end of the peer group.

It's also worth highlighting that Magellan has increased its distribution every year since its initial public offering (IPO) in 2001. Given the high yield, you probably shouldn't expect distribution growth to be huge from here, but there's no reason to expect a cut, either. In fact, management increased full-year 2022 guidance after the first quarter because things have been going so well lately. While it can take a strong stomach to go against the grain, this still largely out-of-favor midstream player -- it's still down 40% from its all-time high -- and its high yield are well worth a deep dive today.

A key player in a high-potential industry

Neha Chamaria (Bloom Energy): The hydrogen fuel cell market is still in its nascent stage, but most clean energy experts expect green hydrogen to play a crucial role in helping the world decarbonize. There's a reason behind that: Hydrogen has critical industrial uses, but most hydrogen today is extracted from fossil fuels, and therefore emits huge amounts of carbon dioxide and is a significant source of pollution. Green hydrogen, on the other hand, is produced from renewables. One company that's already showing a lot of promise in the hydrogen fuel cell space is Bloom Energy.

Bloom Energy builds energy servers using solid-oxide fuel cells that can convert hydrogen, natural gas, or biogas into electricity. Its servers can then produce uninterrupted electricity at the site where it's needed. It sounds like a hugely promising product – any customer that buys Bloom Energy's servers can effectively generate electricity the clean way and enjoy uninterrupted supply of that generated power. It's no surprise, then, that Bloom Energy counts some of the world's largest organizations among its customers.

Bloom Energy's business has grown rapidly over the years. Its revenue grew at a compound annual growth rate (CAGR) of 28% between 2017 and 2021. The company foresees even better days ahead, projecting compound revenue growth of 30% to 35% through 2031.

Bloom Energy isn't profitable yet, but it's earning positive gross margin and expects to generate positive cash from operations this year. The company entered 2022 with record backlog, and recently launched an electrolyzer that could help cut its costs significantly.

Of course, Bloom Energy is a risky stock like any other growth stock. But green hydrogen is a promising technology, and Bloom Energy a key player. If you have conviction in green hydrogen, you might want to consider Bloom Energy shares for the long term -- the stock has had a choppy ride so far and has lost almost 30% value in the past six months.

Sell-offs are often a great opportunity to buy

Matt DiLallo (Brookfield Infrastructure): Shares of global infrastructure giant Brookfield Infrastructure are down double digits from their recent high, largely due to the broader sell-off in the stock market. That decline looks like an excellent opportunity for long-term investors to buy shares of this high-quality company. 

One issue that has weighed on the market this year is surging inflation. While inflation is bad for consumers, it's good for Brookfield's infrastructure businesses. That's because 70% of its cash flow benefits from contractual or regulated adjustments for inflation. That enables the company to increase its rates at the pace of inflation. In addition, 20% of Brookfield's midstream revenue has some market sensitivity. With inflation driving commodity prices higher, this market-sensitive revenue will rise. These factors helped Brookfield deliver record earnings in the first quarter. They should also help fuel organic earnings growth at the high end of its target range in the near term.

Meanwhile, two other issues weighing on stock prices -- higher interest rates and a potential slowdown in the global economy -- should also benefit Brookfield. Higher rates will make it more expensive for companies to borrow money, which could provide Brookfield with more acquisition opportunities, given its superior balance sheet. It will face less competition for deals, while more companies might need to sell assets to finance their expansion. Likewise, a slower economy could cause sellers to reduce their asking prices, especially as other prospective buyers pull out of the market. Brookfield has historically made some of its best acquisitions during times of uncertainty.

Market sell-offs are often the best times to buy shares of Brookfield. Its stock price typically declines even though its underlying operations tend to hold up quite well, and it often finds its best deals. With the recent market turbulence sending shares down double digits, now looks like a great time to buy.