The stock market has been intimidating for beginners this year. Major stock indexes are falling, and several factors are keeping volatility high. This makes it difficult for new investors to choose stocks to buy and hold. Luckily, there are key characteristics that can help investors identify the best stocks for the long haul.

Key characteristics

If you're searching for a stock to buy and hold forever, there are a few key characteristics to look for. An economic moat is probably the most important consideration for investors with a long time horizon. This refers to a sustainable competitive advantage that prevents other competitors from threatening a company's ability to generate profits. WIthout a moat, a stock is unlikely to produce strong returns over the long term.

Smiling person in an office holding a clock and giving the thumbs-up.

Image source: Getty Images.

The other key characteristics are either strong growth or cash flows. Some companies have the opportunity to expand operations by creating and marketing innovative new products. Other companies can't grow as quickly, but they maximize efficiency to generate as much cash flow as possible, which can then be passed along to investors as dividends.

You probably won't generate much dividend income on a $20 investment, so this exercise will focus on two wide-moat growth stocks with the ability to expand.

1. Nvidia

Nvidia (NVDA -10.01%) is a leading semiconductor stock with fantastic growth prospects and strong competitive advantages. The company rose to prominence as a specialist in graphics processing units (GPUs). It has since spread to other high-growth applications including gaming, artificial intelligence, autonomous driving, data centers, cryptocurrency mining, and analytics hardware.

Growth investors often focus on the software industry, because hardware businesses tend to be more cyclical and harder to scale. That's certainly part of the story with Nvidia right now. The company's latest quarterly report showed a 17% decline in revenue and a 50% decline in adjusted earnings. That comes with the territory for semiconductor stocks, which are subject to fluctuating demand and inventory buildups.

These issues have combined with rising interest rates to pull Nvidia shares much lower throughout the year. The stock's forward P/E ratio is around 38 right now, having fallen from around 90 at the peak of the COVID-19 recovery bull market. That's created an opportunity to buy at a reasonable valuation. Instead of the recent poor performance, investors should focus on Nvidia's long-term growth prospects and wide economic moat.

Nvidia's moat consists of a high barrier to entry and elite product strength. Developing high-performance GPUs requires a team of capable engineers across a multiyear product development cycle. That's an expensive and high-risk proposition for prospective competitors, so it's hard for disruptors to break into the market.

Nvidia's R&D budget is almost $7 billion, which has contributed to the rapid production. The company has historically churned out new generations of its products at an exceptionally fast pace. These factors should make investors confident that Nvidia will remain a leader in a high growth industry, even if there are some challenges in the short term.

One important note for investors -- Nvidia shares were recently trading for around $160, so you'll need to purchase fractional shares if you want to find a great buy for $20. Fortunately, most major brokers offer fractional shares to account holders.

2. Workday

Workday (WDAY -1.34%) is an innovator in human capital management (HCM) software. HCM is a broad set of tools that enable HR departments to function efficiently and unlock value among employees. Employee expenses are the largest costs for many businesses, especially in technology and services industries. That highlights the importance of employee productivity and engagement.

Workday was in the right place at the right time, rolling out a high quality HCM platform that was based on the cloud. First-mover status allowed the company to quickly amass market share, and it now boasts more than 60 million total users across 9,500 organizations.

That's an important piece of Workday's economic moat. It has an established an important role in the regular function of numerous enterprises. It would be burdensome of customers to switch to another alternative, so high switching costs protect its competitive position. Workday is also spending more than $1 billion annually on product development to maintain its position at the top.

In addition to the wide moat, Workday is driving strong growth. Its sales are expanding around 20% annually. The company also produces positive free cash flow, so it provides a rare combination of growth and profits. The stock's forward P/E ratio is below 32, having previously been around 70. That's an attractive entry point for long-term returns, and this company has the characteristics to deliver across multiple decades.

Workday shares are also around $150, so investors who are looking for a $20 deal will need to use fractional shares.