You might have heard about the so-called "October effect." The idea is that the stock market tends to decline during October. Is this something for investors to worry about? Not really.

To be sure, several of the biggest stock market crashes have occurred in October. However, the S&P 500 index often delivers positive gains during the month, including six of the past 10 years.

There's no way to know whether or not the market will pull back this month. But you can have a game plan in place just in case it happens. Here are three stocks to buy without any hesitation if there's an October stock market sell-off.

A person holding a hand over a touchscreen tablet.

Image source: Getty Images.

1. Dollar General

How many customers do you think decided not to shop at Dollar General (DG 0.70%) because of the last stock market crash? What about the one before that? My guess is zero. Actually, Dollar General's business increased during the market meltdown in 2020 as consumers stocked up because of expected COVID-19 lockdowns.

The best one-word description for Dollar General is resilient. This company performs well when the economy and stock market are rocking. It also performs well when that isn't the case. 

Dollar General has delivered same-store sales growth for 31 consecutive years. Despite facing tough year-over-year comparisons with the booming coronavirus-fueled business in 2020, the discount retailer still expects to keep its growth streak going this year.

The company is on track to open 1,050 new stores this year. It's rolling out access to more healthcare products and services. Dollar General has also achieved early successes with its new pOpshelf stores. Regardless of what the stock market does, Dollar General will continue to expand.  

2. Etsy

I suspect that Etsy (ETSY -1.41%) would be one of the many stocks that drop significantly if there's a major market sell-off this month. Big declines when the overall market is falling are par for the course with growth stocks like Etsy that trade at high forward earnings multiples.

However, buying Etsy on any pullback would be a smart move, in my view. The company's platform is the go-to site for niche handcrafted products that consumers simply can't find anywhere else. And its long-term growth prospects are tremendous.

Etsy has gone on a buying spree this year, acquiring fashion reseller Depop and Latin American e-commerce company Elo7. The U.S. second-hand clothes market is projected to double within the next five years. The Latin American e-commerce market is expected to soar to $160 billion by 2025 from $50 billion in 2019.  

The company estimates its total addressable market tops $1.7 trillion. No, Etsy won't ever capture all of that market. It doesn't have to, though, to still be a huge winner over the long term.

3. Vertex Pharmaceuticals

The most likely reasons for a stock market crash this month are increased COVID-19 concerns or slowing economic growth. Neither factor would impact Vertex Pharmaceuticals (VRTX 0.71%) much, if at all.

Vertex commands a monopoly in treating the underlying cause of cystic fibrosis (CF). The company's four approved drugs are the only good alternatives for CF patients. Physicians won't quit prescribing these therapies because stocks are falling.

The big biotech also has several paths to deliver strong growth over the coming years. Vertex still has plenty of room to expand the sales of its CF franchise by securing reimbursement deals and expanding its approvals to address more patients.

While Vertex doesn't have any non-CF candidates in late-stage testing, its pipeline could nonetheless produce big winners within a few years. The company and its partner, CRISPR Therapeutics, hope to file for approval in 2023 for a gene-editing therapy targeting rare blood disorders beta-thalassemia and sickle cell disease. Vertex also has promising drugs in phase 2 testing for treating pain and genetic kidney diseases. 

Again, there's a good chance that the market won't tank in October. However, buying shares of Vertex -- like buying Dollar General and Etsy stocks -- should pay off over the long term no matter what the stock market does.