Hybrid systems have emerged as a reliable solution to meet the increasing demand loads in various fields and address the electricity shortage in remote areas. Consequently, research efforts have been directed towards determining the optimal sizing of hybrid system components to cater to different areas' demand loads. Effective energy management of hybrid micro-grid components is essential to ensure the delivery of high-quality and cost-effective power supply globally. Various optimization techniques have been employed to achieve this objective and determine optimal solutions. This paper proposes an improved version of the Flow Direction Algorithm (FDA), named mFDA, to determine the optimal sizing of a standalone system comprising solar panels, a diesel generator (DG), and a battery bank to meet the demand load in Luxor, Egypt. The primary objective of this research is to reduce the cost of energy (COE) of the system, the net present cost (NPC) of the proposed hybrid power system, the probability of a power supply loss (LPSP), and the size of a microgrid's components. The proposed methodology aims to provide an effective solution to optimize the hybrid system's performance and energy management, which can be applied in other regions as well. To achieve economic energy with high quality and effective sizing with the lowest annual cost in the shortest amount of time, Results from the proposed mFDA are evaluated with those from the original (FDA), Grey Wolf Optimizer (GWO), Gorilla Troops Optimizer (GTO), a new Optimization technique based on COOT Bird Natural Life Model (COOT), and Smell Agent Optimization (SAO) algorithm. The MATLAB program's simulation results indicate that the proposed modified mFDA algorithm performs better than other algorithms when it comes to designing hybrid microgrid component sizing. After 44 iterations, the mFDA approach demonstrates stable convergence characteristics and achieves a minimum Cost of Energy (COE) of approximately 0.2658555/kWh, a Low Probability of Sustainable Power (LPSP) of 0.06555, and a Net Present Cost (NPC) of 7,767,179. The original FDA method closely follows, attaining a COE of about 0.2658555/kWh, LPSP of 0.06555, and NPC of 7,767,179. • Effective energy management of hybrid micro-grid components. • Improved approach using modified Flow Direction Algorithm (mFDA). • Primary objective: reduce cost of energy, net present cost, LPSP, and size. • mFDA achieves best design of hybrid microgrid components in shorter time. • Proposed approach helps achieve economic energy with low annual cost. [ABSTRACT FROM AUTHOR]