As you know all investments have risks, there are things you can do as a long-term investor to manage those risks and be prepared.
With that in mind, to my knowledge, there has never been a documented, real-world study done by anyone ever showing that repeatedly moving from the market to cash and back to the market works. You would need to be right about when to get out, then when to get in and do it over and over again.
There is a world of difference between short-term speculation, which is picking stocks or timing the market, and investing which is long-term and goal-driven.
The issue with speculating is that if you get burned just once, it will most likely be "game over” and your performance permanently affected, meaning that you may likely outlive your money through a 30 plus year retirement.
See a quick video where I take a quick look at the evidence behind why market timing doesn't work when it comes to your long-term financial security.