It can be mentally taxing to buy a stock after it has gone on a huge run. However, experience has taught me that buying winning stocks and holding them for the long term is actually one of the smartest ways to invest.

EPAM Systems (NYSE:EPAM), BlackLine (NASDAQ:BL), and Paycom Software (NYSE:PAYC) all qualify as red-hot stocks right now. Each of these companies has crushed the S&P 500 year to date, and all three are currently trading near their all-time highs.

Despite the run-ups, right now is a great time to buy all three of these businesses. Here's why.

Rocket blasting off.

Image source: Getty Images.

EPAM Systems -- up 27%

EPAM Systems provides outsourced software engineering and IT consulting services. The company counts more than 23,000 engineers, designers, and consultants in its workforce that can be quickly deployed to tackle any project that its clients can think of.

EPAM has built a name for itself as being able to deliver high-quality custom-built products in a timely fashion. That reputation helps the company consistently bring in new clients and keep existing ones coming back for more. As a testament to this company's stickiness, consider that its top 20 clients have been with EPAM for an average of eight years.

For investors, the dependability of EPAM's services makes the company's financials highly predictable. More than 90% of EPAM's revenue is recurring in nature, so investors should have high confidence in management's ability to deliver on guidance. That's great, because EPAM's revenue and net income both jumped by more than 30% in the most recent quarter. The broad-based prosperity allowed management to boost guidance for the full year

Looking ahead, market watchers project that EPAM's earnings will grow by more than 19% annually over the next five years. That's quite strong for a company that is only trading for 27 times next year's earnings. 

BlackLine -- up 66%

Ask any accountant about the most painful part of their job and the odds are good that they'll talk about the period-end close. This labor-intensive process occurs when the accounting department reviews every recent company transaction to create the financial statements that management teams and investors need to make decisions. While this is a mission-critical business function, it is riddled with inefficiencies.

A former accountant named Therese Tucker was so frustrated with this process that she set up a company to ease the burden once and for all. Tucker's solution was to create software that aggregates data from a number of financial sources and reconciles it in near-real time. She then began to sell this solution using a software-as-a-service business model.

To say that BlackLine's solution is a hit with accountants would be a huge understatement. More than 2,400 companies from around the world now count themselves as BlackLine customers. This includes dozens of heavy hitters like Costco, Shire, Kimberly Clark, and Coca-Cola.

What's wonderful about this business is that BlackLine continues to roll out new services on top of its core period-end-close product. This allows the company to pull in more revenue from existing customers as it adds new ones. The combination helped drive 32% revenue growth last quarter. The increased scale has enabled the business to produce cash flow and profits, too.

Best of all, there's ample reason to believe that BlackLine still has plenty of room left for growth. The company estimates that its total addressable market opportunity is $18 billion. That's an enormous number when compared to the $177 million in revenue that was generated last year. In other words, investors should expect this company to be able to drive double-digit revenue and profit growth for the foreseeable future.

Paycom Software -- up 86%

Many employers rely on a variety of systems to manage all of their human resources needs. This often forces employees to enter their basic data into multiple different systems when they want to request time off, change their schedule, review their time and attendance records, or view their paycheck.

Paycom Software is a cloud-based software provider that is attempting to bring order to this chaos. The company offers employers and employees a single sign-on platform that enables them to handle a wide variety of human resources functions with ease.

The simplicity of Paycom's solution has allowed it to win market share away from the industry giants for many years. For example, last quarter, the company's revenue jumped 31% to $129 million. Profits grew even faster thanks to favorable operating leverage. Wall Street applauded the fast growth by sending shares to fresh all-time highs

Despite the prosperity, Paycom's CEO and founder Chad Richison believes that its growth story is still just getting started. He believes the company has only captured about 2% of its total addressable market. Since his goal is to become the largest payroll processor in the industry, there's quite a bit of room left for continued growth.

Richison's ambitions might be lofty, but the company boasts a long history of setting the bar high and then jumping over it with ease. Given the opportunity and track record of success, this business can continue to grab market share for many years to come.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.