Trying to time the stock market during a presidential election year could cost investors. Here’s how to stay the course.