This paper studies optimal macroeconomic policy when nonlinearity in the business cycle is described by a vector smooth transition autoregression (VSTAR). A structural identification of the VSTAR that yields a low-dimension and certainty-equivalent nonlinear quadratic regulator (NLQR) problem is derived. Optimal rules are calculated by adapting from the engineering theory the approach of State Dependent Riccati Equation, which allows standard dynamic programming techniques to solve NLQR problems. The methodology is employed to study optimal conventional and quantitative easing (QE) monetary policy using a VSTAR model estimated on data for the United States during 1979-2018. The model allows for regime changes during periods of economic slack and when interest rates are near the zero lower bound. The results highlight the quantitative significance of nonlinearity in the analysis of optimal monetary policy and how the size, timing and composition of QE can influence macroeconomic dynamics.