If the price of stock goes up then it is a bad time to purchase stock
A stock is a better investment when the price per earning is lower
Or in other words a better investment when the earning per price is higher
If there are transaction fees to move in and out of cash from cash to an index fund or an index fund to cash
Then you can lose money by the time you need it again if the inflation is high enough and the interest on the fund low enough