Why moving in and out of the markets can be a costly mistake