Enhancing Stock Market Forecasting with a Stacked LSTM Model Integrating Technical Indicators and Market Sentiment - David Baraka Makindu; Calvins Otieno; James Obuhuma (International Journal of Scientific Research in Computer Science, Engineering and Information Technology, 2025)
Background: The accurate prediction of stock prices remains a significant challenge due to market volatility, non-linear patterns, and the influence of diverse factors like economic indicators and investor sentiment. Traditional models like ARIMA and shallow machine learning models often fail to capture these complexities. Methods: This study develops and evaluates a Stacked Long Short-Term Memory (LSTM) neural network model for stock market forecasting. The model integrates heterogeneous data sources, including technical indicators, macroeconomic variables, and sentiment scores derived from financial news headlines using FinBERT. The architecture employs two LSTM layers, dropout regularization, and Bayesian hyperparameter tuning. We trained the model on a diverse dataset of four major indices (S&P 500, NASDAQ, FTSE 100, Nikkei 225) from 2010 to 2024 and evaluated its performance in a zero-shot setting on the unseen Shanghai Stock Exchange (SSE) Composite index. Results: The proposed Stacked LSTM model significantly outperformed traditional benchmarks (ARIMA, GARCH, SVM). It achieved an R² of 0.956 and the lowest RMSE (105.18) on the test set. In the critical zero-shot cross-market evaluation on the SSE, the model demonstrated strong generalization with an R² of 0.93, whereas ARIMA and GARCH failed entirely (R² ≈ 0). The incremental addition of technical indicators and sentiment features progressively improved predictive accuracy, with sentiment reducing short-term prediction errors by approximately 15% during volatile periods. Conclusion: The results confirm that a deep Stacked LSTM architecture, enriched with multi- source features and robust regularization, provides a superior and generalizable framework for stock market forecasting, offering substantial improvements over conventional methods.