Abstract
Accurate stock price forecasting remains a challenging task due to the complex, nonlinear, and sentiment-driven nature of financial markets. This study presents an intelligent hybrid framework that integrates long-short-term memory (LSTM) networks with metaheuristic optimization and financial sentiment analysis to improve stock price forecasting. Initially, three single-layer, two-layers, and three-layer LSTM architectures are evaluated using fixed parameters, showing that deeper networks do not always perform better without proper tuning. Three nature-inspired algorithms, particle swarm optimization (PSO), gray wolf optimization (GWO), and artificial rabbit optimization (ARO), are used to optimize the model configurations. Experimental results showed that PSO consistently outperformed other techniques in all evaluation metrics (RMSE, MAE, R², MAPE). In the final stage, sentiment features extracted from economic news are integrated into the input data using the FinBERT model. The resulting hybrid model, SEN_PSO_LSTM, achieved superior forecasting performance on the four major stocks Apple, Amazon, Google, and Microsoft, as well as three others from diverse industries, including JPMorgan Chase in the financial sector, UnitedHealth Group in healthcare, and Toyota Motor in the automotive industry.The findings confirm that combining deep learning with hyperparametric optimization and sentiment analysis significantly improves forecasting accuracy under volatile market conditions.