Hybrid systems constitute one of the solutions for supplying isolated applications. Such systems are classically based on clean energy sources. When the renewable energy sources have intermittent productions, they are associated with storage systems. This makes the system economically more interesting. Economically speaking, hybrid energy systems using multiple energy sources are often expensive and their cost must be optimized. This optimization can be done for the system sizing or for its energy management. However, optimizing one does not guarantee the optimization of the other. Indeed, previous studies optimize either the design and apply it with a simple energy management strategy, or the energy management with predetermined sizing supposed optimized, while minimizing the number of sources that contain the hybrid system. In this paper, an energy management and sizing algorithm, applicable to multisource systems, composed of a large number of sources, is proposed. The method is based on a modified centered moving average filters architecture for energy management, which permits one to consider and to automatically balance the forecasting errors in solar and load profiles. The energy management is then limited to a small number of parameters, which are the averaging horizon and weight coefficients. It is then possible to optimize, at the same time, the sizing and the energy management of such power systems. The proposed optimization criterion is based on a techno-economic approach, by considering acquisition and operation costs, as well as the ageing of the different devices. The main novelty of this approach is the use of energy management formulation that is able to manage an architecture with a high number of controlled devices. An original formulation of centered moving average filters also permits one to automatically balance the power bias due to forecasting errors on the renewable resources and the load profile. The method is applied to five devices, including photovoltaic panels, a fuel cell, two batteries with different technologies (Li-ion and lead-acid) and supercapacitors.