Comparative Analysis of LSTM, Random Forest, and XGBoost Models for Stock Price Prediction in the Indian Equity Market
Abstract
The stock market constitutes a system comprising sellers and buyers who engage in buying and selling shares of publicly listed organizations, with prices constantly changing depending on supply, demand, economic factors, and investor's emotions. Forecasting changes in prices in the stock market is most challenging within the realm of computational finance due to its noisy, non-linear nature and high levels of temporal dependence. This study conducts an analysis of three leading models, LSTM, RF, and XGBoost used for predicting prices of five India Stocks: HDFC Bank, Reliance Industries, ITC Limited, Maruti Suzuki, and Sun Pharma. Stock data from the period of fifteen years, ranging from 2010 to 2025, was collected using Zerodha Kite and preprocessed into a dataset containing thirty technical indicators including Relative Strength Index (RSI), Moving Average Convergence Divergence, Bollinger Bands, VWAP, and ATR. Correlation matrix was used to analyze feature interdependence and determine the predictors of price. The outcomes show that LSTM was found to yield the best test-set results when predicting closing prices, with 96.22% price accuracy and 3.83% MAPE in Reliance Industries. However, despite having smaller training errors, RF and XGBoost showed high degrees of overfitting in the test set for highly volatile stocks like Maruti Suzuki and Sun Pharma. Technical indicators were determined to be the strongest predictors of price; lag-based indicators and momentum signals ranked among the top features in all cases. Thus, this research proves that LSTM is the most effective architecture for sequential data while ensemble tree models need regularization techniques or larger look-back windows.