We consider the problem of the optimal trading strategy in the presence of linear costs, and with a strict cap on the allowed position in the market. Using Bellman’s backward recursion method, we show that the optimal strategy is to switch between the maximum allowed long position and the maximum allowed short position, whenever the predictor exceeds a threshold value, for which we establish an exact equation. This equation can be solved explicitely in the case of a discrete Ornstein-Uhlenbeck predictor. We discuss in detail the dependence of this threshold value on the transaction costs. Finally, we establish a strong connection between our problem and the case of a quadratic risk penalty, where our threshold becomes the size of the optimal non-trading band.