This paper highlights the importance of accurate demand forecasting for effective inventory management in a dynamic and competitive environment characterized by uncertainty, financial constraints, and logistical limitations. While existing evaluation metrics, such as MAE and RMSE, offer complementary benefits, they suffer from the potential for biased evaluations when applied individually. To address this, we propose the Hierarchical Evaluation Function (HEF), a composite function that integrates R², MAE, and RMSE within a hierarchical and adaptive framework. HEF incorporates dynamic weights, a tolerance threshold derived from the statistical properties of time series, and an incremental penalty mechanism to ensure robustness against extreme errors and invalid forecasts. We optimize multiple forecasting models using Grid Search, Particle Swarm Optimization (PSO), and Optuna, and test them on benchmark datasets such as Walmart, M3, M4, and M5. Statistical tests demonstrate that HEF consistently outperforms MAE in global metrics such as R², Global Relative Accuracy (GRA), RMSE, and RMSSE. This means that HEF offers greater explanatory power, adaptability, and stability. While MAE maintains its advantages in simplicity and efficiency, HEF proves more effective in long-term planning and complex situations. Therefore, HEF becomes a powerful and adaptive alternative for model selection and hyperparameter optimization in highly volatile demand forecasting environments.