🏆
International Engineering Publisher
Serving Researchers Since 2012

Adaptive Performance-Weighted Ensemble for Robust Next-Day Stock Direction Prediction

DOI : 10.5281/zenodo.24130552
Download Full-Text PDF Cite this Publication

Text Only Version

Adaptive Performance-Weighted Ensemble for Robust Next-Day Stock Direction Prediction

N. Ravi, Rithik N S, Rithin Akash P S, Chanakya P S, Dharanish A, Aakash T, Balaji D

Department of Information Technology, PSG Polytechnic College Coimbatore, Tamil Nadu, India

Abstract – Prediction of stock markets is challenging due to the presence of factors like non- linearity, dependencies, volatilities, and others in financial time series. Various machine learning/deep learning models capture different features of stock price time series dynamics. In this paper, we propose the framework called Adaptive Performance-Weighted Ensemble (APWE) that utilizes the information about the future day stock price direction via LSTM, GRU, and XGBoost models. APWE uses historical daily OHLCV data plus some technical indicators, like daily return, moving averages, RSI, MACD, volatility, and volume change. Output of each model is the probability of an upward price movement. Rather than keeping static ensemble weights, APWE determines the weight of each model depending on its recent performance and produces an ensemble output from the individual model outputs. In our experiment, APWE performance was tested for a particular time interval using TCS. Historical data of NS stock were obtained from Yahoo Finance in the period from January 1, 2018, to September 1, 2026. Cleaned data consisted of 2,117 observations, including 1,693 observations for training and 424 observations for testing. Based on the results, it can be stated that GRU is the most accurate individual model with 49.76% accuracy, and APWE has 44.05% accuracy equivalent to equal weight ensembles. It can be concluded from the results that the use of adaptive weighting does not improve the accuracy as compared to equal weighting. It is necessary to conduct additional research to reveal the cases when adaptive weighting proves to be beneficial.

Keywords – Stock market prediction, LSTM, GRU, XGBoost, ensemble method, adaptive weighting, time series prediction, financial machine learning.

  1. INTRODUCTION

    Prediction of stock markets has become one of the important issues to be explored in the field of financial data analytics since there is high interest in the future movements of the stock markets from the side of investors and financial analysts. There are various factors which have significant impact on the movements of stock prices such as past performance of stock prices, volume of trade, volatility of market, behavior of the investors and economic conditions in general.While traditional Machine Learning models find the associations between different input variables, the Deep Learning models find the associations depending on the time-based information obtained from the sequence of data. Among the existing approaches, the LSTM Network finds the time-dependent associations by remembering useful information at each time-step. Another approach is Gated Recurrent Unit (GRU), which uses a simpler recurrent model to find the sequential associations. XGBoosting is an ensemble method based on decision trees.

    Although a single model is able to predict accurately, its ability to do so might not be consistent for all the periods of the markets. Markets undergo different periods of volatility and trendiness. Therefore, what might have worked well in one period might not work well in other periods. In employing ensembles of multiple models, the dependency is lessened but equal weighting of each model means that they all have an equal weight.

    This paper tries to present a novel Adaptive Performance-Weighted Ensemble (APWE) framework that can solve this problem. The idea behind it is to combine the predictions from LSTM, GRU, and XGBoost models while modifying their weights depending on how accurate they predicted lately. The weight of a specific model becomes higher when it predicts accurately lately.

    This study focuses on predicting the next day’s stock market direction (UP or DOWN) rather than forecasting the exact stock price.

    The key aims of this research include:

    1. Using LSTM, GRU, and XGBoost models to predict the next day’s stock market direction.

    2. Feeding historical OHLCV data and technical indicators into the models.

    3. Creating a dynamic weighting scheme depending on the results of recent predictions.

    4. Merging the probabilities provided by the individual models.

    5. Analyzing the efficiency of the suggested ensemble in terms of Accuracy, Precision, Recall, and F1-score.

    6. Creating the comparison between the adaptive ensemble and individual models and equally weighted ensemble.

  2. RELATED WORK

    esearchers have shown growing interest in using machine learning algorithms and deep learning techniques to forecast stock market trends.Various models were employed to identify temporal dependency, nonlinear relationship and interaction among financial variables.

      1. LSTM-based Stock Forecasting

        Long Short-Term Memory is neural network that was invented due to the problem of learning dependencies in recurrent neural networks. The Long Short-Term Memory is constructed based on memory cells as well as gating units which control the information that should be stored in memory cell [1]. Stock prices data can be considered as a sequence and hence, have been used for different predictions employing the LSTM method.

        Fischer and Krauss explored the use of LSTM networks for predicting stock movements and showed how recurrent neural networks can classify financial time-series data [2]. However, the accuracy of LSTM models depends on the dataset and the market conditions during the selected period

        A. Prediction using GRU

        GRU networks are a type of recurrent neural network designed to learn patterns from sequential data. The GRU uses gates but has a simpler architecture than LSTM [3].

        The simplified architecture makes GRU suitable for use in time-series analysis applications that also require computational efficiency.

        In the case of financial forecasting, GRU is capable of identifying correlations among observations at various time- steps.

      2. XGBoost for Financial Prediction

        XGBoost is a machine learning method that uses decision trees and gradient boosting to make predictions .It is efficient in modeling non-linear and interaction terms between the inputs [4]. Recurrent neural networks are not used to model sequence data, however, once the historical and technical features are defined, XGBoost can provide good predictions from financial datasets.

        Different characteristics of recurrent models and tree-based models make these approaches good candidates for an ensemble method.

      3. Ensemble Learning for Stock Prediction

        Ensemble learning is the process in which the output is generated by combining multiple models to give the prediction output. The reason behind using ensemble learning is that different mode l s will identify different patterns from the same data. Previous studies have used both machine learning and deep learning models together to predict stock market movements [5], [7]

        A popular method applied in the literature is using static weights for each model in the ensemble method. This method fails to consider the different performance of models under different market situations.

      4. Adaptively Combining Models

    In financial forecasting, adaptive models and mixture-of- experts methods are also used when the performance of each model changes depending on the input data or market conditions.These models highlight the significance of giving different weightage to different predictive models under varying circumstances. In this study, the proposed APWE model uses a clear method to update model weights based on their recent performance. Unlike the earlier model, which uses fixed weights, the proposed method updates the weights regularly

    Of each model based on their previous trades .

  3. BACKGROUND: Machine Learning and Deep Learning Methods

    In this part, the prediction models that will be applied in the suggested approach will be presented.

    1. Long Short-Term Memory (LSTM) Networks

      LSTM is a recurrent neural network model that operates with sequences of data. In LSTM there are memory cells and gates controlling the flow of data within the network.

      The LSTM network has three main gates: the input gate, forget gate, and output gate.For forecasting the stock market, one may apply the sequence of observations to the LSTM model. Then the network recognizes the temporal dependencies between the past observations and provides the forecasts for the next trading day.

      It means that LSTM may be used for financial tasks involving time series.

    2. Gated Recurrent Unit

      The GRU, which stands for gated recurrent unit, is a kind of recurrent neural network based on the idea of applying gating mechanisms to control the information flow. According to the proposed framework, GRU is provided with past sequences of data to capture temporal patterns from stock data, and the output of probabilities is used by the adaptive ensemble model.

    3. XGBoost

      XGBoost is a gradient-boosting method that builds several decision trees. Each new tree tries to correct the mistakes made by the previous trees.In the current research, XGBoost uses artificial numeric features such as historical prices, returns, moving averages, RSI, MACD, volatility, and volume-related features. The prediction of the probability of the next days UP class is made.

    4. Ensemble Learning

      An ensemble model uses the outputs of several models together. Let us assume that there are three models generating the following probabilities:

      P_LSTM, P_GRU and P_XGB.

      The probabilities can be calculated for a simple ensemble as follows:

      P_EQ=(P_LSTM+P_GRU+P_XGB)/3

      However, such an approach presupposes that all the models have the same prediction capabilities.

    5. Adaptive Performance Weighting

      APWE instead assigns a different weight to each model according to its recent prediction performance. For each model , recent performance is calculated as:

      where represents the number of correct predictions made by model in the recent window and represents the total number of predictions in that window.

      The normalized weight is then calculated as: The final probability becomes:

      The final direction is determined as:

  4. PROPOSED METHODOLOGY AND SYSTEM ARCHITECTURE

    The suggested APWE framework involves collecting data, preprocessing, feature engineering, training models, probability creation, adaptive weighting, ensembling, and performance updating.

    1. Data Collection

      Historical daily data from the stock market are gathered for experiment validation.

      The dataset includes the following OHLCV features:

      • Open

      • High

      • Low

      • Close

      • Volume

        The current experiment validation is based on TCS.NS. Other stocks will be tested in future studies to check how well the model performsData Preprocessing

        The collected data have been organized on the basis of their trading dates. The handling of any missing or faulty observations takes place in the process of preprocessing. The data is further organized in chronological order.

        Due to the time-series nature of the problem of financial prediction, the observations have not been randomly shuffled prior to the process of training and testing. This will help keep the chronological relationship between the past and future observations.

    2. Feature Engineering

      Additional technical indicators have been created based on the historical stock data. The suggested set of features includes:

      • Daily return

      • Moving Averages

      • RSI, MACD

      • Volatility

      • Volume change

    3. Target Definition

      The prediction target is the direction of the next trading day’s closing price.

      For a given trading day, the target is defined as:

      A target value of 1 represents an upward stock movement (UP), while a value of 0 represents a downward movement (DOWN).

      The target is created using the next day’s closing price. This future price is used only to check the prediction after it has been made

    4. Individual Model Prediction

      The prepared dataset is passed to all the three prediction models.LSTM model handles the sequential observations.

      sequence of historical data.

      XGBoost model handles the feature vectors using tree based boosting approach.

      Each model predicts the probability of the stock being UP on the next trading day.

      Thus, P_LSTM, P_GRU, and P_XGB are obtained.

    5. Adaptive Performance Weighting

      Adaptive Performance Weighted Ensemble (APWE) technique mainly revolves around the idea of adaptive weighting scheme. Rolling windows of recent predictions are maintained for each model. A rolling window of last 20 predictions may be kept.

      Once the actual market direction is known, the prediction of each model is compared with the actual output.

      The latest performance of each model is calculated These values are converted to normalized weights. For instance, if the recent performance of LSTM model is better than GRU and XGBoost, then LSTM model gets relatively more weight for predicting the next stock value. In case of change in relative performance, these weights are updated accordingly.

    6. Final Direction Prediction

    Each probability output by the models is multiplied by their corresponding adaptive weights. The results are then summed up to yield the final APWE probability. The resulting probability value is checked against a threshold value of 0.5.

    If the probability is above 0.5, the direction predicted by the framework is UP. Otherwise, it predicts DOWN. Once the true result is known, the performance window of the model is updated before predicting the next direction.

    Fig. 1. APWE system architecture and prediction workflow.

  5. SYSTEM WORKFLOW

    The first step involves gathering the historical stock data and

    organizing them chronologically. Then, the data are cleaned and technical indicators are calculated. The target variable is formed depending on the next-day closing price direction. Next, the prepared data are fed into the LSTM, GRU, and XGBoost models.

    Each of the models provides the probability of upward move.

    The most recent prediction performance of each model is calculated via rolling window approach. Performance values are then normalized in order to determine adaptive weights. Finally, the weighted probabilities are summed up in order to receive the final APWE probability. Depending n the probability threshold, the system makes either UP or DOWN prediction. After the real direction of the market for the next day becomes known, the prediction accuracy of each model is calculated. The rolling performance information is updated, and the weights for further prediction are changed.

  6. PROPOSED ALGORITHM

    Algorithm 1: Adaptive Performance-Weighted Ensemble

    Input: History OHLCV data & technical indicators..

    Output: Next-day UP/DOWN prediction.

    1. Gather the daily stock historical data.

    2. Arrange the gathered data chronologically.

    3. Calculate the technical indicators chosen.

    4. Generate the direction target of the following day.

    5. Partition the data through temporal split for training and testing.

    6. Train the LSTM model using the historical data.

    7. Train the GRU model using the historical data.

    8. Train the XGBoost model using the feature- engineered data.

    9. Calculate the UP probability using the trained models.

    10. Keep track of the latest performance of each .

    11. Calculate the recent accuracy of LSTM, GRU, and XGBoost.

    12. Normalize the performance values to derive the model weights.

    13. Calculate the weighted ensemble probability.

    14. Classify as UP if the calculated probability is greater than 0.5 else classify as DOWN.

    15. Once the actual direction of the following day is known, evaluate against each model’s prediction.

    16. Update the window of the recent performance.

    17. Re-calculate the weights for predicting the next direction.

    18. Iterate the steps until the end of the test period.

  7. DATASET AND EXPERIMENTAL SETTING

    1. Dataset

      In the experiment, the historical daily data of TCS (TCS.NS) were taken from the website of Yahoo Finance. The data were for the period between January 1, 2018, and September 1, 2026. The downloaded dataset included 2,143 records. After cleaning the data, there remained 2,117 records. These cleaned data were separated into 1,693 training observations and 424 testing observations chronologically. A lookback window of 20 trading days was used for LSTM and GRU models.

    2. Feature Configuration

      Input features consist of historical OHLCV variables and technical indicators calculated from the historical variables. The chosen technical indicators include moving averages, RSI, MACD, daily return, volatility, and volume change. The input feature list needs to be maintained the same in each individual model as much as possible.

    3. Target Configuration

      The target is the future movement of the closing price on the next trading day.

      For 1, this indicates that the movement is UP, while 0 indicates that the movement is DOWN.

      We can now formulate the problem into a binary classification problem.

    4. Data Splitting

      Data splitting is done based on chronological order rather than randomly shuffling the data set. The earlier part of the observations is utilized for training while the latter for validation to avoid the use of any future information in training the model.

      The adaptive weighting algorithm is done sequentially so that future outcomes cannot be known before the corresponding predictions.

    5. Model Configuration

      Three different prediction models are used as follows:

      LSTM: To learn temporal patterns in the historical sequence.

      GRU: To learn sequential patterns using recurrent neural network.

      XGBoost: To find out the nonlinear dependencies between the engineered financial features.

      The above-mentioned configurations have been used to train the above models with 20-trading days look-back for the recurrent models. Early stopping has been used for training LSTMs and GRUs.

    6. Method of Evaluation

      Each of the models separately is examined before their results are compared with those of the equal-weighted ensemble and the recently proposed APWE method. The following criteria will be employed during the evaluation process: Accuracy, Precision, Recall and F1- Score.

      TABLE I

      DATASET AND EXPERIMENTAL CONFIGURATION

  8. EVALUATION METRICS

    TABLE I I

    PERFORMANCE COMPARISON OF THE TESTED MODELS:

    1. Accuracy

      Accuracy =

    2. Precision

      Precision=TP/(TP+FP)

    3. Recall

      Recall=TP/(TP+FN)

      TP + TN

      TP + TN + FP + FN

    4. F1-Score

    F1=2×(Precision×Recall)/(Precision+Recall)

    These metrics will be used to compare the performance of the different models

  9. RESULTS AND ANALYSIS

    The models were compared based on accuracy, precision, recall, and F1-score. The comparison included LSTM, GRU, XGBoost, the equal-weight ensemble, and the proposed APWE model.

    The proposed APWE model was tested using historical TCS stock data with a time-based evaluation method. Among the individual models, GRU achieved the highest accuracy of 49.76%. XGBoost and LSTM achieved 44.76% and 43.57%, respectively. Both the equal-weight ensemble and APWE model achieved the same accuracyThis shows that the effectiveness of adaptive weighting depends on the type of data used

    Fig. 2. Model Accuracy Comparison

    From the comparison of the models, it is noted that the GRU model was the most accurate model among all individual models with an accuracy of 49.76%, whereas the XGBoost model and LSTM model were the second and third most accurate mode ls with accuracies of 44.76% and 43.57% respectively. The GRU model also achieved the highest recall and F1-score among all the individual models.The equal weight ensemble technique and the APWE technique yielded the same results in the current study with an accuracy of 44.05%, a precision of 41.69%, a recall of 73.08% and an F1-score of 53.09%. It can be concluded from the above results that there was no improvement in the results using the APWE framework c ompared to the equal weight ensemble for the current TCS dataset.

    Fig. 3. Adaptive model weights during the testing period.

    Figure 3 shows how the weights of LSTM, GRU, and XGBoost changed during the testing period These weights vary depending upon how well each of the models performs recently. The weight of the GRU model is higher in some portions of the testing period, but the weights of LSTM and XGBoost models depend upon how well they perform. This shows that the role of each model changes at different stages of the APWE process

  10. DISCUSSION

    The results of experiments provide the comparisons between individual models and ensemble methods for the prediction of next-day stock direction prediction. The GRU was able to give the best results out of all individual models. It gave the highest accuracy rate of 49.76% and F1-score of 58.71%.

    Accuracy of the LSTM is 43.57% while that of XGBoost is 44.76%. As shown from the above results, the performance of models depends on certain factors including the nature of the stock data and the testing period used.

    In the current study, the accuracy of equal-weight ensemble and APWE is the same and equals to 44.05%. Thus, the adaptive performance weighting mechanism was unable to perform better than the equal-weight ensemble for the current TCS dataset. This may be because the performance of the models has not changed much in recent tests. The results also show why it is important to compare individual models and ensemble methods with a single prediction modelThe above findings can be regarded as the baseline for future improvement of APWE model by experimenting on different window sizes, indicators, and stock prices.

  11. LIMITATIONS

    There are some limitations to the APWE model developed here too. First, the existing experiment was conducted on the dataset obtained from just one stock, that is, TCS, and based on the historical data. Second, the test was done for a particular testing period, and the behavior of the market will vary depending on the period. Third, the existing adaptive weighting method depends on the performance of the recently created model and does not necessarily increase the accuracy of p redictions, which can be seen from the current experiment. Finally, stock market movements are influenced by several other factors that are not included in the current model

    The above limitations create room for improvement of the current framework.

  12. FUTURE WORK

    Future research can test the APWE model using different stocks and market conditions to check whether it performs well across different situations.The performance evaluation period and the weighting approach can be fine-tuned to enhance the ability of the ensemble in adapting to different situations. Other technical factors and market-related variables can be considered to enrich the input information for the purpose of forecasting. Future experimental work may also consider the use of more data and longer testing time periods in order to conduct thorough comparative studies of the model.

  13. CONCLUSION

The present paper provided the Adaptive Performance- Weighted Ensemble (APWE) approach to next-day stock direction prediction based on LSTM, GRU, and XGBoost. The ensemble of prediction probabilities for the models is formed on the basis of their weights depending on their past performance.

The performance of the separate models, equal weight ensemble approach, and the suggested APWE was checked experimentally through using historical data of TCS stocks. GRU turned out to have the best result among the separate models with 49.76% accuracy, but the accuracy of APWE amounted to only 44.05%, which is equal to that of the equal-weight ensemble in the current experiment.

So, in this study, adaptive weighting did not lead to any improvement in the prediction results.However, the conducted experiment provides the foundation for future research of adaptive ensembles in relation to various stocks, time spans, and market states.

REFERENCES

  1. S. Hochreiter and J. Schmidhuber, Long short-term memory, Neural Computation, vol. 9, no. 8, pp. 1735

    1780, 1997.

  2. T. Fischer and C. Krauss, Deep learning with long short-term memory networks for financial market

    predictions, European Journal of Operational Research, vol. 270, no. 2, pp. 654669, 2018.

  3. K. Cho, B. van Merriënboer, C. Gulcehre, D. Bahdanau,

    F. Bougares, H. Schwenk, and Y. Bengio, Learning phrase representations using RNN encoder-decoder for statistical machine translation, in Proc. EMNLP, 2014, pp. 1724 1734.

  4. T. Chen and C. Guestrin, XGBoost: A scalable tree boosting system, in Proc. 22nd ACM SIGKDD Int. Conf. Knowledge Discovery and Data Mining, 2016, pp. 785794.

  5. W. William, A. K. Wilham, and S. R. Manalu, Stocks

    APPENDIX A: FEATURES USED FOR STOCK

    and models: A comparative benchmark of machine learning and deep learning approaches for stock market prediction, Procedia Computer Science, vol. 269, pp. 15321545, 2025, doi: 10.1016/j.procs.2025.09.095.

  6. V. Pandey, M. Pandey, Y. Pathak, and R. Haripriya, Hybrid recurrent expert gating: An adaptive mixture of experts framework for financial time series prediction, Procedia Computer Science, vol. 283, pp. 29983007, 2026, doi: 10.1016/j.procs.2026.06.366.

  7. M. Jiang, J. Liu, L. Zhang, and C. Liu, An improved stacking framework for stock index prediction by leveraging tree-based ensemble models and deep learning algorithms, Physica A: Statistical Mechanics and its Applications, vol. 541, Art. no. 122272, 2020, doi: 10.1016/j.physa.2019.122272.

APPENDIX B: MODEL AND EXPERIMENTAL

#

Feature

Description

1

Open

Opening price of the trading day

2

High

Highest price during the trading day

3

Low

Lowest price during the trading day

4

Close

Closing price of the trading day

5

Volume

Number of shares traded during the day

6

Daily Return

Percentage change in closing price

7

Moving Average

Average closing price over a specified period

8

RSI

Relative Strength Index used to represent price momentum

9

MACD

Moving Average Convergence Divergence indicator

10

Volatility

Measure of variation in stock price

11

Volume Change

Change in trading volume compared with the previous period

Parameter

Value

Stock

TCS.NS

Data Source

Yahoo Finance

Data Period

2018-01-01 to 2026-09-01

Original Records

2,143

Records After Cleaning

2,117

Training Records

1,693

Testing Records

424

Lookback Window

20 trading days

Prediction Target

Next-day UP/DOWN

Models

LSTM, GRU, XGBoost

Ensemble Methods

Equal-Weight Ensemble, APWE

Evaluation Metrics

Accuracy, Precision, Recall, F1-score