You probably know that most experts caution against trying to time the stock market. Yet, if you think there’s trouble ahead, could moving entirely to cash ever be a good idea?

Financial advisors typically offer an emphatic no. Some, though, offer a caveat.

“If you have all the money you’ll ever need, and don’t need to take on any risk to accomplish all of your goals for the rest of your life, sure, move to cash,” said certified financial planner David Robbins.

“But realistically, that’s a rare scenario,” said Robbins, vice president of investments at Moors & Cabot in Phoenix.

Susana Gonzalez | Bloomberg | Getty Images

Stocks have zigzagged their way through 2020 so far, which can make some investors nervous, experts say. Both the Dow Jones Industrial Average and the Standard & Poor’s 500 index reached fresh highs in mid-January before pulling back due to fears over the impact of the coronavirus on the global economy. And while both have bounced off last week’s drop, there could be more volatility ahead.

At the same time, however, the economy — now in its 11th year of expansion — continues chugging along. The job market remains strong, with unemployment at 3.5%. And the major stock indices are coming off a year of double-digit gains: In 2019, the Dow rose 22.3% and the S&P was up 28.9%.

Regardless of what stocks do, cash is an important part of any financial plan, experts say. Many advisors recommend that people generally have at least three to six months’ worth of emergency savings set aside — which typically means having a cash account you can tap without worrying about the securities markets’ effect on its value.

For retirees, however, advisors often recommend keeping two to three years’ worth of income in investments that are not subject to the whims of the stock market. Depending on a person’s particular situation, part of that strategy could include a cash component.

“There can be value in holding cash, but it should be part of a larger plan, not because you’re running for the hills,” said CFP Erika Safran, founder of Safran Wealth Advisors in New York.

For long-term investors — say, younger workers saving for retirement — it’s important to remember that while the stock market might jump around or enter a prolonged downturn, no losses you see on paper are locked in unless you sell. And history has shown that the market always ends up going back up — and surpassing its previous high.

There can be value in holding cash, but it should be part of a larger plan, not because you’re running for the hills.

Erika Safran

founder of Safran Wealth Advisors

For investors who might nevertheless feel tempted to go to cash when the markets are dropping and wait for the dust to settle, the question you should ask yourself is: When would I get back in?

“The average investor would tell you that their objective would be to sell at the peak and buy back in at a much lower point,” Robbins said. “However, in practice, the vast majority of clients who try to time the market will sell based on fear and wait until they feel less fearful to buy back in.

“That often results in buying in for a higher price than they sold for,” he added.

And, there is inflationary risk that comes with cash. If you put all your money in a savings or money market account, it would need to earn more in interest than the current rate of inflation for you not to lose purchasing power over time.

“If the cost of goods and services is … increasing at a rate of 3% and cash is returning below that, things are actually getting more expensive for the investor as time goes on,” said Ben Smith, CFP and founder of Cove Financial Planning in Whitefish Bay, Wisconsin.

Additionally, if you own stocks that pay dividends, you’ll miss out on those periodic payments, as well.

Of course, there’s always the chance that you could get the timing right. For illustration purposes only: Say you had sold 10 shares of an S&P 500 fund when the index peaked in October 2007 at 1,565, and then repurchased shares when it bottomed in March 2009 at 666. In that case, your money would buy 23 shares — more than double the amount you sold.

At the same time, though, you would have missed five dividend payments and, once reinvested, their future gains, as well.

More from Personal Finance:
One in 5 fear they’ll owe the IRS money this spring
Here’s why getting a raise can actually hurt your retirement
How to buy a house despite student debt

More importantly, recognizing both the top and bottom is tricky.

For example, when the market began to slowly climb back upward in early 2009, the U.S was still in a recession, which didn’t end until that summer. Unemployment was still climbing — it didn’t peak until October 2009 when it hit 10% — and the foreclosure crisis was continuing to worsen.

“When you factor human emotions and behavioral finance into it, oftentimes the market bottom — the ‘best time to buy’ — is the time when people are the most fearful and things look the absolute worst,” Robbins said.

Additionally, if your money is in a portfolio that is based on your risk tolerance — generally a combination of how well you sleep at night when the market gyrates and how long until you need the money — your exposure to stocks may not be as high as you assume.

Nevertheless, if the market’s movements have you feeling skittish, it’s a shoulder-tap signaling that you might want to reevaluate your risk tolerance. In other words, depending on your situation, it could be appropriate to reduce the amount of risk in your portfolio by moving some of your holdings to cash.

Generally speaking, though, the longer until you need the invested money — say, it’s for a retirement decades away — the more likelihood that you’ll need to out-earn cash-like returns to meet your goals over time. That would mean taking on investments that outperform over the long term but might go up and down a lot in the short term — i.e., stocks.

Smith said it’s normal for some clients to ask about whether they should move to cash — or increase their position — when markets get turbulent.

“Those that reach out primarily want to confirm that their asset allocation still matches their risk tolerance and long-term goals,” Smith said. “I explain that the volatility we’ve experienced recently, and may continue to experience, is factored into their asset allocation and is largely considered normal, especially for clients with longer-time horizons.”

Subscribe to CNBC on YouTube.