This chart shows why investors should never try to time the stock market

Key Points
  • Investors should avoid the impulse to time the market, new data from Bank of America shows.
  • Looking at data going back to 1930, the firm found that if an investor sat out the S&P 500′s 10 best days per decade, total returns would be significantly lower than the return for investors who waited it out.
  • And the market's best days typically follow the largest drops, meaning panic selling can lead to missed opportunities on the upside.

Timing the market is difficult at the best of times for even the most experienced traders.

Now, Bank of America has quantified just how large the missed opportunity can be for investors who try to get in and out at just the right moment.

Looking at data going back to 1930, the firm found that if an investor missed the S&P 500's 10 best days each decade, the total return would stand at 28%. If, on the other hand, the investor held steady through the ups and downs, the return would have been 17,715%.

When stocks plunge a natural impulse can be to hit the sell button, but the firm found the market's best days often follow the biggest drops, so panic selling can significantly lower returns for longer-term investors by causing them to miss the best days.

"Remaining invested during turbulent times can help recover losses following bear markets - it takes about 1,100 trading days on average to recover losses after a bear market," noted Savita Subramanian, head of U.S. equity and quantitative strategy at Bank of America.

Sometimes, as happened in 2020, the recovery is much faster.

The data comes amid a boom in retail traders trying to find the next Tesla or Gamestop pop, and as fast, data-driven strategies become more prevalent across Wall Street. But Bank of America noted simple investing for the long term can be a "recipe for loss avoidance" given that 10-year returns for the S&P 500 have been negative just 6% of the time since 1929.

Of course, the data also shows the astronomical returns for any investor who correctly called the ten worst days of each decade — to the tune of 3,793,787%. Additionally, excluding the 10 worst and best days would have registered a gain of 27,213%.

But given the difficulty of precisely calling the peaks and troughs, the better bet is to simply stay in invested.

Bank of America noted that factors including positioning and momentum typically outperform over the short-term, but fundamental analysis wins over multiple years.

"Whereas valuations explain very little of returns over the next one to two years, they have explained 60-90% of subsequent returns over a 10-year time horizon," the firm noted. "We have yet to find any factor with such strong predictive power for the market over the short term."

Looking ahead Subramanian envisions more muted returns, or about 2% per year for the S&P 500 over the next decade. Including dividends, returns stand at 4%. The forecast is based on a historical regression looking at today's price relative to normalized earnings ratio.

The firm added that over prior periods of similar returns, including between 1964 and 1974 as well as from 1998 to 2008, there was a higher probability of loss, pointing to the merits of staying invested for the long haul.

- CNBC's Michael Bloom contributed reporting.