
Predicting Prices of Stocks in the Market by Using Past Data and Prices
Iman Al-Ali
17/03/2026
Stock price prediction is a challenge that meets both finance and data science, which is important for investment strategy and economic analysis. This research investigates the application of machine learning models to forecast stock prices using past market data. By using many datasets’ stock prices (open, close, high, low), four distinct models; Linear Regression, Decision Tree, Random Forest, and a Neural Network, were developed and evaluated. To increase accuracy and mitigate overfitting, a technique was implemented to dynamically weight each model's prediction based on its Mean Squared Error (MSE) performance. Furthermore, a trading simulation was created for multiple stocks, for example Meta Platforms Inc. (META) initialized with $10,000 generated a profit of $101,313 over 1,200 days, highlighting the potential of dynamically weighted ensembles to enhance both predictive power and trading profitability. This study concludes that an AI-driven, ensemble-based approach can accurately predict stock prices, effectively minimize investment risk, and serve as a powerful tool for traders and investors.