While the outlook for commodity prices is now much brighter than it was just a few months ago, there’s still the danger of further challenges. After all, commodities are dependent on demand and supply. Both of these factors can change rapidly over a short space of time and with very little warning. As such, having a margin of safety appears to be a prerequisite when buying resource-focused stocks.

For example, the world’s largest silver miner Fresnillo (LSE: FRES) trades on a price-to-earnings growth (PEG) ratio of just 0.6, which indicates that its shares are undervalued at the current time. That’s based on very strong growth forecasts in the next financial year, with Fresnillo expected to increase its bottom line by as much as 66% due in part to a rising silver price.

Certainly, there’s the potential for the silver price to fall as it did in recent years prior to the recent pickup. However, Fresnillo was able to remain profitable even when silver hit its low points following a 70% fall between 2011 and 2015. This shows that the company’s cost base is relatively low and that while a fall in the silver price can’t be ruled out, Fresnillo is likely to survive and emerge from it in good shape.

Tough times

While Fresnillo has performed well as a business in recent years, Glencore (LSE: GLEN) has endured a rather more difficult period. Like most of its peers, Glencore has been hurt by falling commodity prices and this has caused investors to question the company’s financial standing. Specifically, the market has become concerned about Glencore’s debt levels and there was a general feeling among investors that the company was riskier than a number of its similarly-sized sector peers.

In response, Glencore is implementing a strategy that’s eeing asset disposals being made, efficiencies being generated and the company’s balance sheet risk reduced. Although this is an ongoing process that will take time to complete, investors appear to be upbeat about the company’s prospects to become more financially sound and better able to cope with a prolonged and severe downturn in commodity prices.

With Glencore trading on a PEG ratio of just 0.6, it appears to offer a sufficiently wide margin of safety to merit investment at the present time. It has relatively high risks but considerable potential rewards.

Margin of safety

Meanwhile, Highland Gold (LSE: HGM) has benefitted from the rising gold price in 2016, with the company’s shares surging upwards by 71% since the turn of the year. However, with US interest rate rises on the horizon, the appeal of gold could wane even if uncertainty across global markets makes its status as a store of wealth more appealing to nervous investors.

In such a scenario Highland Gold seems to be relatively well-prepared. It has a debt to equity ratio of 34%, which indicates that its balance sheet is modestly leveraged. Furthermore, it has strong cash flow, with free cash flow standing at $65m in the 2015 financial year and just under $39m in the 2014 financial year. And with Highland Gold having a PEG ratio of just 0.2, it seems to have a sufficiently wide margin of safety to merit investment from less risk-averse investors.

A better buy?

Despite this, there's another stock that could be an even better buy. In fact it's been named as A Top Growth Share From The Motley Fool.

The company in question could make a real impact on your bottom line in 2016 and beyond. And in time, it could help you retire early, pay off your mortgage, or simply enjoy a more abundant lifestyle.

Click here to find out all about it - doing so is completely free and comes without any obligation.

Peter Stephens has no position in any shares mentioned. The Motley Fool UK has no position in any of the shares mentioned. We Fools don't all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors.