Investing in the stock market has the general assumption that, a priori, stocks are more likely to rise than to fall at any given point in time. Under that assumption, the all-at-once strategy has the better expected outcome. Of course, you can be unlucky and end up buying the all-time-high just before a crash. You can avoid that risk by splitting up the investment, at the cost of lowering the overall expected value. So it’s more about how you feel
about that risk, and whether you feel avoiding it is worth having a somewhat lower expected return.