Artificial Neural Network Model for Stock Movement Forecasting

Prediction of Stock Market movements has always been a challenging and complex task to accomplish. In this context, Artificial Neural Networks (ANNs) is eyed as one of the potential research fields to design and develop a solution to this problem.

Previous research works show that Multi Layer Perceptron (MLP) based Artificial Neural Network (ANN) models trained with Backpropagation algorithm deliver the highest accuracies for the selected use case. This paper presents the design of an Artificial Neural Network trained using LevenbergMarquardt Backpropagation algorithm as well as Bayesian Regularization Backpropagation algorithm.

The Artificial Neural Network model has been developed in MATLAB 2019 software and has currently been trained using a single stock’s data from the National Stock Exchange (NSE). The Artificial Neural Network (ANN) model is also tested for different parameters defining the accuracy in stock movement prediction of the model.

The results achieved tell that Bayesian Regularization Backpropagation algorithm deliver better results as compared to Levenberg-Marquardt algorithm.


Stock markets across the world have always showcased an unpredictable nature, which hasn’t been completely understood till date by experts and analysts in the field. One of the major factors behind the movement of stock markets are the sentiments associated with different events and incidents across the globe. These incidents, irrespective of which country they originate from, affect the stock market indices in nearly all the countries in some manner or the other.

To handle the volatile nature of stock markets across the globe, researchers and analysts have now turned to Artificial Neural Networks (ANNs) as a means to develop a solution for the same. In this regard, an ANN model has been developed, trained and tested in MATLAB 2019b software to predict stock market movements.

This research has been done as a continuation of works performed by [8], [9], [10], [11]. Thus, the ANN model has been trained and tested for data of only one (1) stock from the National Stock Exchange (NSE). We have referred to [1] for any assistance related to the use of Neural Network Toolbox in the software.


For the sake of this research, we have developed an Artificial Neural Network model comprising a total of 10 neurons divided equally among 5 hidden layers. Further, 2 neurons have been considered in the output layer. We have considered 2 years data for Jubilant Foodworks Limited (NSE: JUBLFOOD).

Here it should be noted that prior to developing model using Bayesian Regularization algorithm, efforts were made to achieve the desired results using Levenberg-Marquardt algorithm as presented in [3]. Since we achieved better results using the former algorithm, the results obtained from the latter algorithm have not been included in this paper. 

The dataset used to feed input values to the network comprises of the Opening Price, Highest Price and Lowest Price for each day. Further, the dataset used to feed target values for the network comprises of the Closing Price, Adjusted Closing Price and Trading Volume for each day.

Out of this, we considered 80% dataset for Training, 10% dataset for Testing and 10% dataset for Validation purposes. The ANN model was trained using Bayesian Regularization algorithm to achieve better accuracy. Here it should be noted that [5][6][7] have been referred to achieve better understanding of Bayesian Regularization algorithm for refining the results.

ANN Model developed in MATLAB
ANN Model developed in MATLAB


After simulating the ANN model in MATLAB, we achieved Training Regression (R) of 9.99999e–1 (≈ 1) and an Overall Regression of 0.95596.

Further, the Mean Square Error (MSE) for the network was achieved at 3.794e–10, with the Best Training Performance at Epoch 278. The results obtained have been shown in Fig. 2 to Fig. 6 below.

Fig. 2 Training Regression
Training Regression
Fig. 3 Testing Regression
Testing Regression
Fig. 4 Overall Regression
Overall Regression
Fig. 5 Network Training Performance observed
Network Training Performance observed
Fig. 6 Time Series Response generated for Dataset
Time-Series Response generated for Dataset


This paper presents the design parameters for developing an Artificial Neural Network (ANN) model to predict stock market movements using Bayesian Regularization Backpropagation algorithm. For the sake of input and target datasets, 2 years data of Jubilant Foodworks Limited (NSE: JUBLFOOD) stock has been considered for training the artificial neural network model.

Network training using Levenberg-Marquardt Backpropagation algorithm was also performed for the ANN model developed. Based on the results achieved, Bayesian Regularization algorithm delivered more accuracy than the other algorithm, and hence, have been included in the paper.

Based on the data fed for training, testing and validation purposes into the model, Bayesian Regularization Backpropagation algorithm gave an overall regression of 0.95596 along with a Mean Square Error (MSE) value of 3.794e–10. This outperforms the results achieved from the ANN model developed by Qeethara et. al, who achieved MSE of 0.44312 at Epoch 1000 using the Bayesian Regularization algorithm in.

Leave a Comment