In this paper we investigate portfolio optimization in a Black-Scholes continuoustime setting under quantile based risk measures: value at risk, capital at risk and relative value at risk. We show that the optimization results are consistent with Merton's Two-Fund Separation Theorem, i.e., that every optimal strategy is a weighted average of the bond and Merton's portfolio. We present optimization results obtained under constrained versions of the above risk measures, including the fact that under value at risk, in better markets and during longer time horizons, it is optimal to invest less into the risky assets.