Successful investing requires a long-term mindset. This might even be the single most important investment trait to have. Thinking in terms of decades instead of months or quarters is key as it forces investors to focus on the aspects that really matter, such as a company's fundamentals and growth outlook.

When looking at what stocks to buy and hold for the long haul, say the next 20 years, consider both Etsy (ETSY 0.34%) and Roku (ROKU -10.29%). They have the makings to be winners for your portfolio over that time span.

Differentiated offering

While Etsy shares are down 76% below their peak price, they have jumped 11% in the last eight days. Perhaps investor optimism is rising once again for this online marketplace that sells unique and handcrafted goods. In fact, Etsy is a special business because 87% of buyers said the site sells merchandise they can't find anywhere else. In the hyper-competitive retail sector, this is a beneficial position to be in.

To be clear, the company isn't growing as rapidly as it did during the depths of the pandemic. But in the most recent quarter, gross merchandise sales (or the dollar amount of goods sold on the platform) was still up 1.2% year over year. Revenue increased 7%, and the user base of buyers and sellers expanded as well. Given the unfavorable macro environment, these are positive trends.

Etsy makes for an attractive long-term stock to buy and hold because of its powerful network effects, which underpin the company's economic moat. Warren Buffett, who many consider the greatest investor ever, believes that it's best to invest in businesses that have a moat because it raises the chances that they can defend against the threat of competition.

In Etsy's case, the more buyers it brings on, the better the site is for sellers looking to reach a global customer base. And the more sellers there are, the wider the choices are for buyers. This strong positioning discourages rivals from entering the market.

With the stock currently trading at a ridiculously cheap forward price-to-earnings ratio of 14.8, investors have an excellent opportunity to consider Etsy now.

Streaming beneficiary

Roku is a platform that connects viewers with all of their favorite streaming content in a single and easy-to-use interface. Companies looking to target this engaged audience in a connected-TV format can direct their advertising dollars to Roku. Consequently, this business is in a prime position to benefit from the growth of the overall streaming industry.

Another positive attribute is that while large media organizations like Netflix, Walt Disney, and Warner Bros Discovery must spend tens of billions of dollars to develop and license fresh content each year, Roku avoids playing this game altogether. Instead, it simply gains on the backs of their capital investments.

The company's latest financial update was well-received by Wall Street, pushing its shares up. Roku's revenue soared 20% to $912 million, a figure that crushed analyst estimates. What's more, the streaming business added 2.3 million net new active accounts in the three-month period, bringing the total to 75.8 million.

As is the case with other digital advertising companies, Roku is starting to see the industry pick up. Renewed interest in growth tech stocks this year has lifted Roku shares 129% so far in 2023.

Yet, the stock still sits 81% below its all-time high in mid-2021. And the shares trade at about one-third the valuation of their historical average price-to-sales multiple of 10.3. While the stock has benefited from some serious momentum recently, it remains poised to reward investors over the long term.