Stock Price Forecasting Using LSTM with Cross-Validation - Rifki Ainul Yaqin; Muhammad Iqbal Anshori; Reddis Angel; Ignatius Wiseto Prasetyo Agung; Toni Arifin; Erfian Junianto (Universitas Negeri Surabaya or The State University of Surabaya, 2026)
Stock price forecasting is highly challenging due to the market’s nonlinear, volatile nature, which is influenced by complex economic and behavioral factors. Traditional statistical models and many machine learning approaches often suffer from overfitting and limited generalizability. This study examines the effectiveness of Long Short-Term Memory (LSTM) networks combined with k-Fold Cross-Validation as a lightweight yet robust alternative. Unlike Transformer-based models, which require extensive computational resources,LSTM offers a more resource-efficient solution while effectively capturing temporal dependencies in financial time series. Experiments were conducted on six U.S. stocks (LW, LKQ, IPG, MGM, RL, and CAG) across 1,000 training epochs, using one to two LSTM layers (64–128 hidden units) with the Adam optimizer. Model performance was evaluated using RMSE, MAE, and R² under k-Fold Cross-Validation and compared against Split Validation from prior studies. Results show that k-Fold consistently produced lower error values, confirming its reliability for stable performance estimation. Notably, models using Close-only input achieved lower RMSE and MAE than those with additional indicators (MA200, stochastic), which primarily improved R². This indicates that feature simplicity, combined with robust preprocessing and validation, can outperform more complex inputs in short-term forecasting. In conclusion, integrating LSTM with k-Fold Cross-Validation provides a practical and efficient framework for stock prediction, particularly in resource-constrained settings. However, the findings are limited to specific stocks and indicators. Future work should extend the approach to broader markets, incorporate macroeconomic or sentiment-based features, and explore hybrid architectures to enhance predictive performance further.