This work presents a Mixed Integer Linear Programming (MILP) approach based on a combination of a rolling horizon and stochastic programming formulation. The objective of the proposed formulation is the optimal management of the supply and demand of energy and heat in microgrids under uncertainty, in order to minimise the operational cost. Delays in the starting time of energy demands are allowed within a predefined time windows to tackle flexible demand profiles. This approach uses a scenario-based stochastic programming formulation. These scenarios consider uncertainty in the wind speed forecast, the processing time of the energy tasks and the overall heat demand, to take into account all possible scenarios related to the generation and demand of energy and heat. Nevertheless, embracing all external scenarios associated with wind speed prediction makes their consideration computationally intractable. Thus, updating input information (e.g., wind speed forecast) is required to guarantee good quality and practical solutions. Hence, the two-stage stochastic MILP formulation is introduced into a rolling horizon approach that periodically updates input information.