Last year individual investors lost a steep 9.42% on average—more than double the 4.38% loss for the S&P 500 index. What happened?

The biggest reason for the stark underperformance appears to be botched attempts at market-timing on the part of individual investors, according to Cory Clark, chief marketing officer at research firm Dalbar Inc., which evaluates investment firms, brokerages, advisers and other financial professionals. The company recently published results of an ongoing, 25-year study that has measured the impact of investor decisions to buy, sell and switch into and out of mutual funds over both short- and long-term time frames.

 “Judging by the cash flows we saw, investors sensed danger in the markets and decreased their exposure but not nearly enough to prevent serious losses,” said Clark.  “Unfortunately, the problem was compounded by being out of the market during the recovery months.”

This study provides even more evidence that when markets are quickly going up or down, investors tend to make emotional decisions, and that is virtually always bad news for their portfolio and long-term returns. That does not mean investors have to hold all of their stocks forever, no matter what, but they do have to guard against overreacting to transitory events and emotions.

The Dalbar study showed that last year investors on average underperformed the benchmark stock index in both rising and falling months for equities during what turned out to be something of a roller coaster year. And they did so by exceptionally wide margins of more than a percentage point in two separate months.

For example, in August 2018, a strong month for equities, the S&P 500 generated a return of 3.26%. The average stock investor gained just 1.80% in that month.

And in October, when the S&P 500 lost 6.84% for the month, the average stock market investor lost 7.97%.

Needless to say, poor relative returns like that, repeated over years and decades, can put a serious dent in long-term savings for education or retirement.

Academics and other experts have for years noticed the gap between the returns earned by individual investors and those of the mutual funds, both indexed and actively managed, that they invest in. Generally, they—like Dalbar—attribute the underperformance to poor market timing by the investors.

Last year, Morningstar Inc., the Chicago-based investment research firm, looked at asset-weighted investor returns from mutual funds compared to the comparable underlying performance of the mutual funds themselves for the 10 years ended March 31, 2018.

On average, Morningstar found that individual investors in US stock funds earned an asset-weighted return of 8.32% annualized over that period versus 9.68% annualized for the funds, a 1.36 percentage point deficit.

The pattern persisted across all asset classes, with investors in municipal and taxable bonds experiencing even greater performance gaps than for US stocks while those in balanced or international funds experiencing narrower gaps.

Much of the self-inflicted damage done by investors to their performance appears to have occurred during periods of high market volatility, when they are prone to panic or otherwise respond to negative news, Morningstar noted.

“When markets lurch up and down, investors tend to do worse than the markets and mutual funds because they make timing mistakes,” wrote Russel Kinnel, director of manager research at Morningstar. “Investors large and small tend to sell after downturns only to buy back in after a rally.”

The lesson for investors—in-and-out trading is a practice best left to the professionals.