The all-time highs reached in the markets have made investors wary that a correction is occurring soon because too many stocks are overvalued, but divesting equities and going to cash has many risks.

Despite the fact that many stocks appear expensive, timing the market can be a fool's errand because not only do investors have to sell at the right time, they also have to decide when to enter the market again, said Ron McCoy a portfolio manager with Covestor, the online investing company, and founder of Freedom Capital Advisors in Winter Garden, Fla.

"Going to all cash can be a costly mistake," he said. "Most investors and even professionals aren't that lucky and realizing that is very important."

While investors should take a profit when the opportunity arises, all of their positions should be scrutinized.

"If investors are nervous, they can raise some cash, but should also be prepared to buy back in if they are wrong," McCoy said. "That is not easy to do mentally." 

Before investors divest their assets, they should consider the ramifications of the Trump administration passing a corporate tax break of 15%, which the markets will view favorably because it will boost profits, said Jason Spatafora, co-founder of Marijuanastocks.com and a Miami-based trader and investor known as @WolfofWeedST on Twitter.

"While the market is exceptionally high right now, I understand why some investors feel it's best to hedge their bets and go cash," he said. "These investors need to understand the catalyst first before rushing out the door."

If you liked this article you might like

Equifax Is a Disaster, Jim Cramer Says

Massive Equifax Hack Lifts Cybersecurity Stocks

Closing Bell: Automakers Post August Sales; Nasdaq at New Records for Day Two

Nasdaq Seals New Record but Weak Jobs Report Raises Fed Questions

S&P 500 Nears a New Record as Automakers Rise