I know there are some possibilities to minimize the electric bill as a night fare, and acumulators for heating but I don't know how expensive it'll be. If you decide for the night fares, you can also use the washing machine and other machines during the night with a lower price. I don't know how easy to subscribe are they. Also, if you'll be working, you'll probably will have to heat only one room, and winter is not so long in Madrid if your flat is well isolated (probably it won't be if it has no heating). Well, just adding more dudes for you I guess
The cheapest is central heating, but they usually switch off during the night so you would need a gas individual heating.