the best time is now. You don't need to yank all of it, but you could sure as shit yank some of it. More than that, you could call up the company that sends you your 401k statement every month and say "I want to pull back while the pulling is good, what do you recommend I put this money in to shelter it against what I think is likely to be a downturn in the next 18 months?"
Remember: you can't buy low if you don't sell high. You don't have to sell all of it. You don't have to sell half of it. Let's pretend you have $100. Let's say you liquidate $25. The market goes up another 10% - you have $102.50 instead of $110. You're still making money.
Let's instead assume the market goes down 25%. You have $81.25 instead of $75. And now you dump your $25 cash into stocks that are down 25%. When it goes back to where it was, you have $112.50 instead of $100. And that's if you only liquidate 25% of your portfolio.
The gestalt of the market right now is that there's a lot more downside risk than upside return. The entities invested in the markets are largely those that have to be - ETFs, pension funds, etc. If you don't mind making 3% rather than 10%, go partially to cash.