Investors are concerned that the all-time highs reached in the markets could signal a potential pullback in the near-term, but timing it can be a costly mistake.

While some stocks are overvalued, getting out of the stock market is not a solution and attempting when to buy equities again is tricky, experts said.

"Don't try to time the market by jumping in and out," said Greg McBride, the chief financial analyst for Bankrate, a NewYork-based financial data and content company. "It doesn't work, and you have to make two perfect decisions - when to get out and when to get back in."

Instead of going to cash, one strategy is to rebalance your portfolio back to your original investment mix, he said.

"This also enforces a discipline of buying low and selling high, by lightening up on what has done extraordinarily well and adding more of what hasn't done as well," McBride said. "This means staying invested in a manner that is consistent with your goals and risk tolerance regardless of where the market is."

Dividends are one reason for investors to stay in the market since they can account for nearly half of an investor's returns over a longer period and is an incentive to stay invested, "even if you're nervous about current market levels," he said.

The market is not showing signs of risk currently to warrant a pullback, said Edison Byzyka, chief investment officer of Hefty Wealth Partners in Auburn, Ind.

"There's nothing glaringly of concern for investors to not remain invested," he said.

Although stock valuations can be one indicator of the market, historically they have not proven to be a good one.

The market is showing signs that there is more upside since expansion across several sectors is relatively broad, Byzyka said.

Investors are also demonstrating that they have an appetite for risk and are eager for more, he said.

The bull market is alive!
The bull market is alive!

The amount of credit in the market also appears to be "relatively healthy" as companies are not over-leveraged.

"Those indicators, along with the recent fiscal stimulus that passed, are enough to potentially support an upbeat equity cycle next year," Byzyka said.

When investors try to time the market, they often fail, said Robert Johnson, president of The American College of Financial Services in Bryn Mawr, Pa. Many people wind up buying stocks when they are going up in price and exit the market when stocks are declining.

"This strategy can and often is hazardous to one's wealth," he said.

A JP Morgan Asset Management study conducted in 2014 illustrates why market timing can be detrimental to an investor's returns, Johnson said. The study showed that if an investor stayed invested in the S&P 500 from 1993 to 2013, the return would be 9.2% annualized.

If their trading decisions resulted in missing the ten best days during that same period, then the annualized returns would fall nearly in half to 5.4%.

"The mantra of investors should be 'time in the market is more important than timing the market,'" he said.

One issue is that the stock market is one of the rare markets where people "actually feel better about purchasing after prices have risen," Johnson said. "For some reason, investors are comforted when stock prices have risen and feel it is safer to invest in a market that has recently risen."

Many investors wind up falling prey to their emotions and buy high and sell low. Following the herd can have severe consequences because some people are afraid of missing out and get back into the market when prices have moved substantially higher.

Selling your stocks and going to cash is not the right move to lower your amount of risk, said Jon Ulin, a managing principal of Ulin & Co. Wealth Management in Boca Raton, Fla.

"While we are more than 8.5 years through the current record-breaking bull market, don't jump ship," he said. "Avoid making emotional short-term moves with your investments that could end up hurting your long-term goals."

Determining when the market has reached a new low is difficult to predict, and studies on investor behavior indicate that many Main Street investors underperform the S&P 500 index by about two-thirds over time, Ulin said.

"They end up derailing their investing goals and retirement through poor decisions around market timing," he said. "Timing the market is a fool's game as most people do not have a working crystal ball to correctly call a market top or bottom."

Diversifying your retirement portfolio is a better strategy and can help people reduce the amount of volatility, Ulin said.

"You can implement a disciplined and less emotional approach to managing your money," he said. "Most of the so-called financial experts can't correctly predict the market outcomes for next year any more than a sportscaster on ESPN can correctly predict the outcome of a football game."

More of What's Trending on TheStreet:

More from Stocks

Boeing Needs Improving Technicals Before I Step Aboard

Boeing Needs Improving Technicals Before I Step Aboard

The Fed: To Increase or Not to Increase?

The Fed: To Increase or Not to Increase?

Micron's Earnings Day Move Has Major Implications

Micron's Earnings Day Move Has Major Implications

Insiders Are Bellying Up to the Bar for These Names

Insiders Are Bellying Up to the Bar for These Names

Memory Demand 'Air Pocket' Deflates Micron Stock

Memory Demand 'Air Pocket' Deflates Micron Stock