We consider the optimal risk transfer from an insurance company to a reinsurer. The problem formulation considered in this paper is closely connected to the optimal portfolio problem in finance, with some crucial distinctions. In particular, the insurance company's surplus is here (as is routinely the case) approximated by a Brownian motion, as opposed to the geometric Brownian motion used to model assets in finance. Furthermore, risk exposure is dialled ‘down’ via reinsurance, rather than ‘up’ via risky investments. This leads to interesting qualitative differences in the optimal designs. In this paper, using the martingale method, we derive the optimal design as a function of proportional, non-cheap reinsurance design that maximises the quadratic utility of the terminal value of the insurance surplus. We also consider several realistic constraints on the terminal value: a strict lower boundary, the probability (Value at Risk) constraint, and the expected shortfall (conditional Value at Risk) constraints under the P and Q measures, respectively. In all cases, the optimal reinsurance designs boil down to a combination of proportional protection and option-like protection (stop-loss) of the residual proportion with various deductibles. Proportions and deductibles are set such that the initial capital is fully allocated. Comparison of the optimal designs with the optimal portfolios in finance is particularly interesting. Results are illustrated.