This research conducts a comprehensive analysis aimed at optimizing portfolios comprising 14 stocks listed on the Moroccan stock exchange. Our journey culminates in the construction of portfolios that are meticulously designed to maximize returns while prudently managing risk. These portfolios are the result of an exhaustive Monte Carlo simulation that explored over three million unique portfolio combinations. The simulations take into account the skewness and kurtosis of the return distributions, offering investors a robust framework for decision-making. We collected historical data for theses 14 stocks on the Moroccan market exchange by accessing 5 years' worth of historical data from investing.com.We explore the concepts of Modern Portfolio Theory (MPT), which forms the backbone of our approach, and we employ the power of mathematics and Python programming to bring forth insights that can inform sound investment decisions. The primary focus of this study centers on the incorporation of higher statistical moments from the returns of key financial indices, with a particular emphasis on their skewness and kurtosis characteristics. To achieve this goal, various evaluative criteria derived from these statistical parameters are introduced and thoroughly investigated. Within this research framework, we confront a spectrum of optimization challenges, including the maximization of skewness, and minimization of kurtosis.