Many investors have probably heard the expression: "Be fearful when others are greedy. Be greedy when others are fearful." It means that you should buy stocks based on logic, not emotions. But following its direction is not as easy as it seems. Watching the daily ups and downs of the stock market, it's clear that a lot of investors are highly irrational. The problem is, investing based on impulses usually backfires.

Letting emotions impact investing decisions is a common mistake. What's the solution? One option is to consider dollar-cost averaging, or buying a little of a stock at a time. Investing based on a system can help prevent these emotional urges.

Of course, even with dollar-cost averaging, you want to accumulate the right stocks. Here are three stocks that are so good you can slowly pick up shares regardless of what the market is doing and expect a decent return over the long term.

1. Vanguard S&P 500 ETF

Lots of investors measure themselves against the broader market. But instead of trying to beat it, why not just match it? The Vanguard S&P 500 ETF (VOO 1.00%) is an exchange-traded fund built to mimic the S&P 500, an index of 500 of the largest publicly traded companies in the U.S. The S&P 500 has historically returned an average of 9% to 10% annually.

There is no shame in simply buying the broader stock market. Warren Buffett famously won a million-dollar bet with a hedge fund manager that an S&P 500 index fund would beat a basket of actively managed mutual funds over 10 years. In other words, consistently outperforming the broader stock market is hard.

Since nobody can predict where the stock market will go, it's a perfect stock to add a few shares occasionally and hold. While the market will have ups and downs, it's always gone up over the long term, and it's near all-time highs right now! This a simple way to add a sure winner to your investing strategy.

2. Nvidia

For individual stocks, computer chip company Nvidia (NVDA 6.18%) tops a short list of stocks investors could indiscriminately buy and hold. That's because it's a runaway leader in one of this generation's most important technology breakthroughs, artificial intelligence (AI). Nvidia specializes in chips for highly demanding computing applications, which, for years, was high-end gaming.

However, the emergence of generative AI caused a rush for corporations to invest in building powerful computers to run AI models (which requires crunching massive amounts of data), and it has turned out perfectly for Nvidia. The company quickly became the go-to chip supplier, grabbing an estimated market share of over 80%. Considering research from McKinsey forecasts generative AI will be worth as much as $4.4 trillion in annual economic output, that's an extraordinary opportunity that Nvidia can tap into.

The stock ran wild in 2023, so the share price might eventually give some of that back. Additionally, Nvidia should be part of a well-diversified portfolio. But its long-term growth prospects -- analysts believe Nvidia's earnings can grow by 42% annually -- make the stock an investment you can schedule regular purchases for and hold for years.

3. Tesla

Tech giant Tesla (TSLA -1.11%) might be one of the few obvious winners rivaling Nvidia's long-term growth opportunities. Tesla is a pioneer and leader in the design and manufacture of electric vehicles. However, it has multiple irons in the fire. It's developing self-driving technology, solar energy collection and storage, and AI-powered humanoid robots. Consider the size of these applications. There are billions of homes and buildings worldwide to power, and billions of people doing manual labor. Today, over 1 billion vehicles are on the world's roads, and just a low single-digit percentage are electric. Tesla only needs pieces of these virtual oceans of potential opportunity to create exceptional business (and investment) outcomes.

It can sometimes sound outlandish, but Tesla has been proving pessimists wrong for years. The stock has returned over 15,000% over its lifetime, which goes back to its initial public offering (IPO) in 2010. CEO Elon Musk took over the company just 25 years ago, a very short time considering the returns it has created. Annual revenue is approaching $100 billion, which could be just the beginning if you consider all the flexibility Tesla's business has over the next 25 years and beyond.

Tesla stock has proven volatile at times. Additionally, shares appear expensive after big gains last year. With that said, those looking decades into the future shouldn't be shy about slowly building an investment as part of their diversified portfolio to benefit from owning a piece of this proven innovator.