The first two months of the year weren’t pleasant ones for most investors: By early February, the S&P 500 index had plunged by 11%. But just as suddenly as it fell, the market rose again, completely recouping its losses by the end of March.

It was a head-spinning example of market volatility, and also a test of investors’ discipline. Investors with a long-term strategy should be willing to tolerate short-term fluctuations. If, on the other and, you panicked and sold your investments, you’re probably regretting it—or at least you should be.

Let’s look at two hypothetical investors, each of whom had $100,000 invested in the S&P at the start of the year. On February 11, the bottom of the market correction, Investor A panicked and sold out, withdrawing the $89,500 of his money that was left. Investor B stayed in the market the whole time.

By March 7, the recovery was clearly under way, and investor B’s holdings had risen to $98,000, making him nearly whole. Investor A decides on this same day that it’s safe to get back into the market—but now, he has just $89,500 to put to work. In short, Investor A is wishing he’d been as disciplined and patient as Investor B.

Taking your money out of the market and putting it back in based on the market’s direction is known as market timing, and it’s one of the most costly mistakes an investor can make. Successful investing is all about time in the market—not timing the market.

Investors who time the market generally fail to even match the market’s returns over time. Driven by their emotions, they sell when the market is down, and buy back in when it’s rising. In the process, they commit the classic error of selling low and buying high. The impact on their investment portfolios can be severe.

According to the research firm Dalbar, while the S&P 500 returned of 13.7% in 2014, the average mutual fund investor in the S&P earned just 5.5%--a gap of more than eight points. Long-term data showed a smaller, but still significant, gap. In the 20 years through 2014, the S&P returned an average of 9.85% per year, while individual investors earned 5.19% annually. In both cases, the main factor behind the performance gap is the counterproductive kinds of behavior we’ve been discussing.

One of the big risks with market timing is being out of the market at the wrong time. Simply put, big gains can come in compressed timeframes, and none of us can know when those very profitable days will occur.

According to CNN, if you’d invested $10,000 in the S&P 500 back in 1996, and left it there, you’d have had more than $22,000 by the end of 2011. But if you missed the 10 best trading days during that period, you’d have ended up with only half of that amount.

Successful investing doesn’t require you to predict when the market will rise or fall. It starts with developing a diversified portfolio that is right for your personal goals, time horizon and comfort level with investment risk. From there, it requires patience and the discipline to let the markets do their work. Please contact me if you’d like to learn more about the keys to successful investing.