Buy stocks in October? Isn't this the month that's known for major meltdowns in the past? Sure, October has historically been the most volatile month for stocks. And some of the most infamous stock market crashes occurred in October. 

However, October isn't the worst month for stock performance over the past 50 years; September is. More important, though, investors shouldn't focus on the short-term gyrations of a stock over only one month. When you focus on the long term, buying stocks in October is as smart of a move as buying at any other time during the year.

Some could prefer to target stocks that have been beaten down to try to buy at a bargain price. My view is that an even better approach is to invest in winning stocks that could get soar even higher. Here's why I think Dollar General (NYSE:DG), MongoDB (NASDAQ:MDB), and The Trade Desk (NASDAQ:TTD) are hot stocks you can buy in October and hold for a long time. 

Businessman holding touchscreen tablet with images of bar and line charts

Image source: Getty Images.

1. Dollar General

You might not think that Dollar General would belong in a discussion of hot stocks. But the discount retailer's share price has jumped over 50% year to date. I think the reasons behind this strong performance point to continued growth for Dollar General.

The company has set itself apart from the rest of the industry in 2019. While many U.S. retailers were shutting down stores, Dollar General opened more new stores than any other company. And even though many of these new stores are relatively close to existing stores, sames-store sales are rising -- indicating that the company's expansion isn't cannibalizing sales from its current stores. 

Dollar General's strategy involves more than just adding new stores. The company is remodeling many of its existing stores, including newer and bigger coolers to offer more types of refrigerated products. Its DG Fresh strategic initiative involves shifting to internal distribution of frozen and refrigerated goods to improve margins. Dollar General's Fast Track initiative is streamlining the stocking process in stores and enabling self-checkout by customers.

The company has performed very well in the midst of a relatively strong economy. But when the next downturn comes, Dollar General should continue to rock along as customers turn even more to discount retailers. The stock ranks as one of the best alternatives to recession-proof your portfolio.

2. MongoDB

MongoDB stock has soared over 60% so far this year. This impressive gain was a direct result of the database company's fantastic revenue growth.

The primary secret behind MongoDB's success is that its database was designed from the ground up to support the storage and analysis of unstructured data. Most of the biggest databases used across the world by businesses were originally created decades ago for only structured data organized in rows and columns.

Software-as-a-Service (SaaS) stocks like MongoDB make their money by getting customers to pay regular subscriptions for using their products and services. MongoDB now has more than 15,000 paying customers -- roughly double the number from a year ago. Well over 600 of those customers generate more than $100,000 in annual recurring revenue for Mongo.

With the amount of data -- particularly unstructured data -- growing every second, MongoDB's database should enjoy even higher demand in the future. I look for more high-dollar accounts to accelerate the company's path to profitability. 

3. The Trade Desk

The biggest year-to-date winner among these three hot stocks is The Trade Desk, with its shares skyrocketing close to 70%. And that tremendous performance reflects a recent pullback resulting from a general sell-off of high-growth technology stocks.

For decades, conducting advertising campaigns involved negotiations between advertisers and media companies. It was a slow process without a lot of data to know how well the advertising campaign actually worked. The Trade Desk changed this paradigm, enabling programmatic advertising where customers can target specific customer groups on a wide variety of digital outlets and do so immediately in a way to maximize their return on investment.

The Trade Desk continues to deliver impressive growth. Several key metrics from its latest quarter tell the tale: 42% year-over-year revenue growth, a 250% jump in connected TV (CTV) ad spend, a 270% increase in audio ad spend, and 80% more revenue from selling data to customers.

I think the story for The Trade Desk will only get better. There will be more digital advertising opportunities, especially with the growth in CTV. My view is that the proliferation of TV streaming services will lead to more ad-supported options, expanding the market for The Trade Desk. This hot stock, like Dollar General and MongoDB, is likely to get even hotter.