In this paper we propose an optimization scheme for a selling strategy of an electricity producer who in advance decides on the share of electricity sold on the day-ahead market. The remaining part is sold on the complementary (intraday/balancing) market. To this end, we use probabilistic forecasts of the future selling price distribution. Next, we find an optimal share of electricity sold on the day-ahead market using one of the three objectives: maximization of the overall profit, minimization of the sellers risk, or maximization of the median of portfolio values. Using data from the Polish day-ahead and balancing markets, we show that the assumed objective is achieved, as compared to the naive strategy of selling the whole produced electricity only on the day-ahead market. However, an increase of the profit is associated with a significant increase of the risk.