Transformer Based Nifty-50 Stock Index Close Price Prediction
Keywords:
Nifty 50, Stock Price Prediction, Close Price, Transformer, LstmAbstract
Stock market investment has emerged as a high-growth financial opportunity in the modern economy. The inherently volatile and non-linear nature of equity markets, however, introduces substantial financial risk, making accurate price prediction a challenging yet critically important task. The rapid advancement of artificial intelligence (AI), coupled with the exponential growth in financial data availability and improved computational capabilities, has enabled new frontiers for developing robust and efficient stock price prediction models.
The Nifty 50 index, comprising the fifty most liquid and actively traded stocks listed on the National Stock Exchange (NSE) of India, serves as the benchmark indicator of the Indian equity market and a key barometer of the nation's macroeconomic health. Accurate forecasting of the Nifty 50 closing price, therefore, holds significant value for investors, financial analysts, and policymakers alike.
This study proposes a Multivariate Transformer-based deep learning model for one-step-ahead prediction of the Nifty 50 stock index closing price Nifty 50 stock index historical price data is used as the dataset. Input parameters contain historical prices and technical parameters. To validate the superiority of the proposed approach, its performance is benchmarked against a well-established Long Short-Term Memory (LSTM)-based model. Additionally, an ablation study is conducted to assess the model's predictive efficiency when the input feature set is restricted solely to the four primary price parameters — Open, High, Low, and Close (OHLC). Model performance is evaluated using three standard regression metrics: Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and the Coefficient of Determination (R²). Experimental results demonstrate that the proposed Multivariate Transformer model significantly outperforms the LSTM-based baseline across all evaluation metrics, establishing its effectiveness as a reliable tool for stock index forecasting.





