It has been increasingly difficult for investors to find bargains in the stock market as major indexes trade at or near their all-time highs.

But for those willing to do their homework, there are still deals to be had. One such company is Tencent Holdings Limited (TCEHY 2.19%), which offers investors both an attractive price and compelling long-term outlook.

Gamer plays game on desktop.

Image source: Getty Images.

Tencent is an incredible cash-generation machine

Tencent is an example of what most investors are looking for. Since going public in 2004, it has been profitable every single year. Not only that, net profit has grown from 447 million yuan in 2004 to 188.7 billion yuan in 2022. That's more than a 400-fold increase!

At the core of Tencent's success lies its flagship social media and messaging app, WeChat. With more than 1.3 billion users, the app offers messaging, social networking, payment services, and more. This multifaceted functionality has made it indispensable to many people in China, and the large user base provides Tencent a strong foundation to generate revenue through services like advertising, entertainment, and e-commerce transactions.

Another pillar of Tencent's profitability is its gaming business, which has a significant presence both in China and globally. It owns leading gaming companies like Riot Games (League of Legends), Supercell (Clash of Clans), and a stake in Epic Games (Fortnite). The popularity of these titles, coupled with Tencent's continuous investment in new game development, ensures a steady income stream in the future.

Besides, Tencent has proven to be a good capital allocator as well. It has a solid track record identifying promising ventures and investments. Some of its most successful examples include stakes in companies like JD.com, Pinduoduo, and Sea Limited. On top of these strategic investments, Tencent has actively participated in the public market, buying up minority stakes in companies like Tesla, Snap, and others.

Tencent's long-term growth has put it in the same league as the biggest companies on the planet, making it difficult to repeat such a performance in the future. Still, its leadership across gaming and social media should give investors confidence that the company can continue to generate billions in annual profits.

The stock is trading at an attractive valuation

It's no secret that, as a group, Chinese companies have been facing enormous challenges over the last few years. The ongoing tensions between the U.S. and China, the Chinese government's crackdown on technology companies, strict pandemic lockdowns, and the unsteady macroeconomy have all weighed on these stocks.

It didn't help that Tencent had one of its worst-performing years in 2022 as it delivered its first-ever annual revenue decline of 1%. Net profit also fell 17% that year. The silver lining is the tech company resumed its growth in 2023 with revenue and operating profit improving 11% and 35%, respectively, through the first nine months of the year.

But just before investors could breathe a sigh of relief, the Chinese government proposed issuing new regulations to control spending on online gaming. The new rule aims to set limits on how much users can spend on in-game purchases and ban daily log-in rewards, which investors fear might impact Tencent's gaming income in the future.

With these headwinds, investors have been bearish on Tencent, especially due to its exposure to the gaming sector. Shares were down 11% in 2023, trailing the broad market by a wide margin. That bearish sentiment has left the stock trading with a rather attractive valuation. For instance, Tencent's price-to-earnings (P/E ratio) is just 13.4 as of this writing, or half of its five-year average.

While there are reasons to be cautious, Tencent's nearly 20-year track record means investors willing to hold the stock for the long run are getting a bargain entry price for one of the best technology companies in the world.