Academy of Marketing Studies Journal (Print ISSN: 1095-6298; Online ISSN: 1528-2678)

Abstract

An Explainable Machine Learning Framework for Predicting NIFTY 50 Stock Market Direction Using XGBoost and SHAP Analysis.

Author(s): Rajendra Prasada Sabat,Sudhanshu Sekhar Nanda,Biplab Kumar Biswal

Predicting the short-horizon directional movement of equity indices is difficult because index returns are close to informationally efficient and the most accurate models are opaque. This study develops a transparent, end-to-end machine learning framework for forecasting the next-day direction of India’s NIFTY 50 index. From 6,315 trading days of daily price data spanning January 2000 to May 2025 we engineer thirty-four technical-analysis features—momentum, trend, volatility and oscillator indicators with lagged returns—yielding 6,266 observations after warm-up, and frame direction prediction as binary classification. Five algorithms (logistic regression, decision tree, random forest, LightGBM and XGBoost) are trained under a strictly chronological protocol with time-series cross-validated tuning and compared on accuracy, precision, recall, F1-score, ROC-AUC and the Matthews correlation coefficient (MCC). Because the 2020–2025 test window is strongly bull-biased, with 55.5% of days closing higher, a trivial always-UP rule attains 55.5% accuracy that no model surpasses—showing that accuracy is an unreliable yardstick in a trending market. On the metrics that measure discrimination, the tuned XGBoost model is the strongest learner, attaining the highest ROC-AUC (0.540) and MCC (0.093); a decision tree’s marginally higher accuracy reflects majority-class prediction and a much weaker MCC (0.059). SHapley Additive exPlanations (SHAP) render XGBoost interpretable globally and locally, identifying the most recent daily return, the 50-day simple moving average, the MACD signal line, lagged returns, the 14-day RSI and return volatility as dominant drivers. The contribution is a reproducible explainable-AI framework that quantifies each indicator’s marginal predictive role and converts opaque ensemble outputs into auditable, decision-relevant evidence.

Get the App