We solve a portfolio choice problem when expected returns, covariances, and trading costs follow a regime-switching model. The optimal policy trades towards an aim portfolio given by a weighted-average of the conditional mean-variance-efficient portfolios in all future states. The trading speed is higher in more persistent, riskier, and higher-liquidity states. It can be optimal to overweight low Sharpe-ratio assets such as Treasury bonds because they remain liquid even in crisis states. We illustrate our methodology by constructing an optimal US equity market timing portfolio based on an estimated regime-switching model and on trading costs estimated using a large-order institutional trading data set. (C) 2019 Elsevier B.V. All rights reserved.