A combined heat and power (CHP) optimization model with heat storage is proposed to minimize the production cost and to maximize the revenue from power sales based on a sliding time window method. The model can be applied both for operating heat storage optimally and supporting investment planning for a new storage. Heat demand is forecasted based on a weather forecast. Each day the heat demand and power price forecasts are input to a generic CHP optimization model for a several-day time window to obtain a heat storage operation plan. Then only the first day of the plan is implemented with actual power price and heat demand using a single-day optimization model to compute the actual production amount, fuel costs and revenue from power sales. After that, the time window is slid one day forward, and the above-mentioned process is repeated. In the test runs, forecasts for power price and temperature are simulated by disturbing actual (historical) data by the Wiener process (random walk). To evaluate the benefit and validate the proposed method, the results are compared with the no-storage case and the theoretical optimum assuming perfect demand and price forecasts. The results show that the revenue from power sales can be significantly improved. The method is used to evaluate the benefit of different sized storages for the CHP system. Also the effect of the width of the time windows on the performance of the method is evaluated. The model was tested using real-life heat demand data for the city of Espoo in Finland, and NordPool spot market data for power price for a one year time horizon. The results indicate that considering the forecasting uncertainty, 5-day sliding time window method can obtain 90% of the theoretically possible cost savings that can be derived based on perfect forecasts. (C) 2015 The Authors. Published by Elsevier Ltd.