A look at Baytex Energy Corp.’s (TSX:BTE)(NYSE:BTE) stock performance over the past several months is not encouraging. Out of a group of 40 oil and gas competitors, Baytex ranked 36th over the past three months, and 38th over the past six months.

This follows a staggering outperformance earlier in the year when shares rose a massive 400% from January to early June. Baytex’s underperformance has led to it trading at a large discount to its peer group. Should this discount unravel (even to a mild extent), Baytex shares could have—at minimum—50% upside.

Before taking a look at the reasons for Baytex’s large discount to its peers and why it should unravel, it is important to look at the size of the discount and some potential scenarios of where it could end up if oil prices recover and sentiment around Baytex improves.

Baytex is one of the cheapest names in its peer group

To value Baytex, it is important to first look at what its cash flow will be next year. Using a fairly conservative oil price of US$55 for 2017, Baytex sees itself earning a cash flow of about $350 million (assuming production of 63,000 bpd, which is conservative). This works out to a cash flow per share of $1.65 per share.

One useful way to value oil stocks is using enterprise value to debt adjusted cash flow, or EV/DACF. This may sound complex, but it is simply the entire value of the business (the enterprise value, or all the shares outstanding plus net debt) divided by the company’s cash flow with all of the interest expenses added back. It is good way of seeing how well a company is generating cash flow relative to the debt it’s taken on.

For 2017, Baytex would have a debt-adjusted cash flow of about $2.13 per share (interest added to the cash flow per share above). This gives it a current EV/DACF of about seven. Baytex’s peers (16 of them) trade at an average of 8.3. This makes Baytex very cheap. In fact, it is the third-cheapest name in its peer group.

If Baytex just traded in line with its peer group (at 8.3 times debt adjusted cash flow), it would have a share price of $9.20. This is 79% above today’s closing price. Even if it still trades at a discount to its peers and only trades at 7.6 times debt adjusted cash flow, it would still have a share price of $7.78—a huge 50% above today’s share price.

This leads to more questions: Why is Baytex trading at such a discount, and can Baytex close this gap?

Fears about Baytex are overblown

Investors have a few problems with Baytex. The main two, however, are that the company has excessive debt levels, and that the company has a weak or declining production profile due to the fact that it gets about 35% of its production from higher-cost heavy oil production sources.

If oil prices do make it to $55 next year (which is approximately where most analysts expect it to be), both of these issues become less of a concern. On the debt front, while Baytex does have more than double the debt levels its peers have, this situation is improving at current oil prices and, at $55-per-barrel oil, would improve significantly.

During the last quarter, Baytex sold off about $66 million of non-core assets, which reduced its total debt. Baytex’s total debt has declined about 9% this year, falling from $2.05 billion at the start of 2016 to $1.86 billion in Q3 2016. Baytex is currently well within all the covenants set by its lenders and would not trip them until oil hits $35 per barrel. The company has no debt repayments until 2021.

As for its weakening production profile, Baytex actually increased the amount of rigs in its Eagle Ford property in the last quarter, and it plans on hiking production from its heavy oil assets once oil moves above $50.

Baytex is undervalued, which makes it a lower-risk, higher-return option.

At Motley Fool, we have another opportunity just like it

The hand-picked investing team inside Stock Advisor Canada recently issued a buy alert for one special type of "bread-and-butter" stock where The Motley Fool U.S. has banked profits on 23 out of 24 recommendations. Frankly, with an astounding 96% success rate that has delivered average returns of 260%, chances are this new pick could deliver life-changing returns as well. Because the team at Stock Advisor Canada fully embraces the same time-tested investing philosophies that have led to countless Motley Fool winners globally. So simply click here to unlock the full details behind this new recommendation and join Stock Advisor Canada.

*96% accuracy includes restaurant stock recommendations from Motley Fool U.S. services Stock Advisor, Rule Breakers, Hidden Gems, Income Investor and Inside Value since each services inception. Returns as of 5/27/16.

NEW! This Stock Could Be Like Buying Amazon In 1997

For only the 5th time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO.

Stock Advisor Canada’s Chief Investment Adviser, Iain Butler, also recommended this company back in March – and it’s already up a whopping 57%!

Enter your email address below to claim your copy of this brand new report, “Breakthrough IPO Receives Rare Endorsement.”

Fool contributor Adam Mancini has no position in any stocks mentioned.