Because the average investor withdrew funds when the market declined last year, they recorded losses of 9.42%, per the report, compared to just 4.38% for the S&P on the whole.

Behavior at the end of 2018 is a striking example. As the market soured in the final months of the year, investors pulled funds to mitigate losses, according to DALBAR's 2018 Investor Behavior Study , but not nearly enough to avoid the full fall. Investors then exacerbated the losses because they were out of the market for the subsequent recovery.

As the stock market swings amid tariff and trade war threats , you might get nervous about the effects on your 401(k) or other investments. But a shaky market is no reason to stray from your financial plan.

If you're saving for retirement through a 401(k) or IRA, then you're investing for the long term. Movements in the market now shouldn't matter much to you if you're decades away from taking disbursements.

Some experts warn that a bear market is imminent. Even if that doesn't turn out to be true — there's no way to predict what the market will do with 100% accuracy — there will be a downturn eventually. Recognizing that should help you overcome urges to sell when things look bad, because the best thing you can do is to keep investing, Danielle Schultz, a certified financial planner, tells CNBC Make It. Embrace the uncertainty.

"I truly believe it's not timing the market, but time in the market that counts for increasing wealth," says Schultz.

In fact, Schultz says young people should "pray for bad markets." If you are contributing the same amount of money to a 401(k) or Roth IRA as you were when markets when higher, then you're getting shares at what is effectively a discount.

"Of course this is terrible for retirees, but generally bad markets early in your career allow you to accumulate more shares at lower prices," says Schultz. "But you have to be invested in the stock market or you won't benefit."

You also don't want to miss out on the recovery. Just as it's a sure thing the stock market will decline in value, historically it has always recovered. Take this example, from "Broke Millennial Takes on Investing," by Erin Lowry:

Investors who stayed the course during the Great Recession were well rewarded in the decade following the crash. The Dow had dropped to 6,547 points in 2009, but it soared to new, prerecession highs by 2018, when it closed at more than 26,000 points. The S&P 500 index quadrupled during the bull run, from its low of 676 points in March 2009 to as high as 2,872 points in January 2018.

If you want a better picture of the true historical gains of the market over time, Schultz recommends looking up what the S&P 500 was on the day you were born, or at the bottom of the recession. Compare that to today for some perspective.

"The long term trend of the market is up, but it's not steady," she says.

The best way to avoid the market anxiety is to set up automatic contributions to your 401(k) or IRA, and forget about them. That takes emotion out of the equation when the market moves. Just ask Warren Buffett.

"Don't watch the market closely," Buffett told CNBC in 2016. "If they're trying to buy and sell stocks, and worry when they go down a little bit … and think they should maybe sell them when they go up, they're not going to have very good results."

Don't miss: Why it's a great time for millennials to contribute to a Roth IRA

Like this story? Subscribe to CNBC Make It on YouTube!