The price-to-earnings ratio is perhaps the most common valuation metric used to evaluate stocks. It's also easy to calculate: Simply take the stock's current price and divide it by its annual earnings per share.

While the P/E ratio is a popular and useful metric, it doesn't tell the entire story of a stock's valuation all by itself. There are low-P/E stocks that investors should avoid like the plague. And there are high-P/E stocks that could turn out to be long-term bargains. Here's why high-P/E stocks can sometimes be smart investments, and two examples of stocks with relatively high P/E ratios that look attractive right now.

Woman at laptop computer holding a credit card.

These two payment-processing stocks may look expensive, but have lots of potential to grow. Image Source: Getty Images.

What determines a stock's P/E ratio?

There are a few factors that contribute to the P/E ratios of stocks.

Market environment is one broad factor. In other words, if the U.S. economy is strong and the stock market is doing well, stocks will generally trade for a higher P/E than in less prosperous times. This is certainly true today, after the market has rallied by 80% in the past five years.

Risk is another determinant of P/E ratio. For example, if two companies have nearly identical business models, but one has a massive debt load while the other is debt-free, the latter is likely to trade at a higher P/E because it has a lower risk of failing. Or if a certain industry is highly cyclical and is expected to experience a downturn, it can cause P/E ratios to drop. To name one example, an expected downturn in the industry is why the major U.S. automotive stocks currently trade for such low valuations.

Finally, growth is an important factor in P/E ratios. More specifically, the expectation of future growth can have a major influence on a stock's P/E ratio. In the two examples I'm about to discuss, both of which are financial technology companies, the high P/E ratios are all due to a high level of growth potential. Square (NYSE:SQ) has a massive addressable market for its products and services with little serious competition, and Visa (NYSE:V) is an industry leader but has lots of untapped potential, especially overseas.

2 high-P/E stocks to consider

Company

Recent Stock Price

P/E Ratio (forward 12 months)

Square

$40.30

100.8

Visa

$110.62

27.3

Data source: TD Ameritrade. Prices and P/E ratios as of 11/15/17.

This company could build a worldwide small business ecosystem

At first glance, Square might look like a ridiculously expensive stock. Its forward P/E is roughly four times that of two other stocks that I refer to as "high P/E." However, Square's lofty valuation is well justified, and the stock could prove to be a bargain if the company's full potential is realized.

For one thing, Square's growth has been impressive. The company's core payment processing business has seen volume soar by 31% over the past year, and Square Capital, the company's small-business lending platform, is originating 45% more loans than it was last year. Subscription- and service-based revenue is up by 84% and is just beginning to scratch the surface of its potential, and the company's results have beaten analysts' estimates for the past several quarters.

Not only has the company's growth been stellar, but there's reason to believe that it isn't going to slow down anytime soon. Square has a massive market opportunity, as the majority of businesses around the world still don't accept card payments. The company is only in five countries so far, and there's a particularly strong opportunity in Asia and the Middle East, two markets where the company hasn't yet established a presence. And as the company's roster of small-business clients continues to grow, it creates tremendous opportunity to cross-sell its other products and services.

Adding to Square's potential is the company's recent decision to experiment with bitcoin in its Square Cash app. Right now, the company is simply testing the waters by allowing certain users to buy and sell bitcoin, but there's massive potential in the bitcoin market, and if Square introduces an easy and fast way for people to get involved, it could mean a big boost to the company's revenue.

The largest payment processor still has lots of room to grow

I'd like to shift gears to another company in the payment-processing industry, where Visa is by far the largest player. In fact, there are more Visa cards in existence than MasterCard, American Express, and Discover cards combined.

You might think of Visa as a mature business with limited upside potential, but you'd be wrong. Just look at the company's most recent earnings -- revenue and adjusted net profit both grew by 26% year-over-year, and payments volume spiked by a staggering 38% on a constant-dollar basis.

The main reason for the strong performance was Visa's international growth. International transaction revenue grew by 45%, and Visa Europe's growth could keep the company's profits growing rapidly for years to come. CEO Al Kelly has expressed his excitement about the growth opportunities in Europe, and the company recently said that its European growth is expected to fuel EPS growth in the "high end of the mid-teens" in 2018.

Visa is also doing a great job of embracing and investing in the latest financial technologies, and its recently expanded partnership with PayPal Holdings is one excellent example. It's also worth noting that Visa is a major investor in Square, buying a substantial stake long before the company's IPO.

From a longer-term perspective, there is tremendous opportunity in Asia and the Middle East to grow Visa's business. Credit cards still aren't widely accepted in many parts of these regions, and China recently opened access to U.S. credit card networks, which creates a massive growth opportunity for the company.

Just one piece of the puzzle

The key takeaway is that stock valuation should be performed with a combination of factors, not just with one metric like the P/E ratio. Growth should certainly be taken into account, as should other factors such as lack of competition, industry trends, and more.

Matthew Frankel owns shares of American Express, PayPal Holdings, and Square. The Motley Fool owns shares of Mastercard, Square, and Visa. The Motley Fool recommends American Express, Mastercard, PayPal Holdings, and Visa. The Motley Fool has a disclosure policy.