The ideal holding period for a stock is forever, or at least that should be a goal. Research shows that investors hamper their returns by trading in and out of stocks rather than holding them for the long term. This is easier said than done, especially for newer investors who may trade more actively due to emotions rather than business performance.

One factor that can reduce the urge to sell a stock is buying great businesses that endure over the long run and have the potential for future growth. Here are two stocks that fit this description and can also be purchased for less than $100.

1. Realty Income

Realty Income (O -0.17%) calls itself "The Monthly Dividend Company," referring to the regular distribution it makes to its shareholders in the form of a dividend. This is something the company takes seriously and it has raised its dividend every year for the past 25 years.

This dividend is directly related to the fact that the company is a real estate investment trust (REIT). This designation requires it to pay 90% of its taxable income to its shareholders. Regular, reliable dividend income is a reason for owning this business.

Realty is in the business of acquiring properties that it then leases to tenants in dozens of different industries. Realty owns over 13,000 properties, the majority of which are single-tenant properties. So far, this business has done very well for its shareholders. It has returned more than 14% annualized since its debut on the public markets, has grown its earnings per share in all but one of those years, and has increased its dividend by a compound annual growth rate of 4.4%. These results are why an investment in Realty of $10,000 in 1994 would be worth $415,000 today.

One of the most important metrics for any REIT is occupancy. Obviously, it's ideal to have every owned property rented out at all times. Realty comes pretty close, with a historical median occupancy rate of 98.2%. For comparison, the occupancy rate for its peers in the S&P 500 is only 94.2%. This suggests that Realty is securing tenants who are happy with their locations and with Realty as the property owner. 

Realty has also done a good job at securing tenants in industries that are insulated from economic downturns and/or changing customer behavior. Pharmacies, grocery stores, big-box retailers, and low-cost providers of nondiscretionary goods make up the majority of Realty's top 20 tenants. 

2. Shopify

E-commerce provider Shopify (SHOP 1.11%) helps anyone start a business by providing the website as well as back-end support to sell and ship products all over the world. Its customers range from small local businesses to global brands like Allbirds. There's a decent chance you've purchased an item from a Shopify-run website and not even known it.

From its initial public offering in 2015, Shopify put up consistently impressive results. During the pandemic, those results were magnified by the rush to online shopping when stores were closed and everyone was at home due to lockdowns. From Q2 2020 through Q1 2021, Shopify posted year-over-year revenue growth near or above 100%. This was not sustainable, but the stock got bid up as if it was. Shopify stock is up 47% year to date, but that's still 70% off its late-2021 high.

That said, investing is about the future, and recently there's been some bright spots that indicate Shopify could be past the choppy results of the past few years. Unlike some other companies that were impacted heavily by the pandemic, Shopify has seen its revenue growth accelerate over the last several quarters.

In Q2 2022, Shopify's revenue growth over the previous year was 16%. It has steadily increased in the quarters since, and in Q2 of 2023 it reached 31%. 

Prior to the pandemic, Shopify consistently had gross margins in the low-to-mid-50% range. It has slipped recently but management is guiding for a 2% to 3% increase for the current quarter, which would bring it back up above 50% for the first time in a year. This is good news, as the company is still looking to get to sustainable profitability and cash generation.

Speaking of cash flow, the company is also expecting to see that tick back up in Q3. Management expects free cash flow for Q3 to exceed the free cash flow for the first two quarters of the year combined.

Shopify is still working through its pandemic-induced challenges, but there's been progress, and management is indicating this should continue. While still not cheap, Shopify's current price-to-sales ratio of 10.6 is well below its historical average and not far off its all-time low of 6.2. In my opinion, this is a compelling valuation for a long-term buy-and-hold purchase of Shopify shares.