Nervous about recent volatility? Try buying stocks over a longer period of time, especially if you’re close to retirement.