American Journal of Business and Operations Research

Stock Closing Price Prediction of ISX-listed Industrial Companies Using Artificial Neural Networks

Salim Sallal Al-Hasnawi, Laith Haleem Al-Hchemi
Volume 6, Issue 2, pp. 47-55 (2022)
DOI: https://doi.org/10.54216/AJBOR.060205
Online: https://americaspg.com/journal/1/article/1095

Abstract

Making stock investment decisions is a complex challenge that investors continuously face. When it comes to an uncertain future, making the wrong decision can result in massive losses. The paper aims to develop an artificial neural networks-based model predicting the closing price of top-six traded industrial ISX-listed stocks, which can guide investment decisions. The sample consisted of daily indexes ISX-released from (3/3/2019) to (31/3/2019). Matlab 2014b was used to run artificial neural networks using the nntool software. The model's performance was evaluated using Mean squared error (MSE), Root means squared error (RMSE), and R squared. Empirical results demonstrated the ability and efficiency of artificial neural networks to predict closing prices with high accuracy. As a result, we recommended employing the Artificial Neural Networks model to predict stock prices as well as relying on it to make decisions.

Keywords: ANN; Stocks; Close Price; Prediction; Investment; ISX

1. Introduction

Stocks are the mainstay of the capital markets and the most important investment tools in them. Stock prices are affected by many financial and non-financial influences in a way that is difficult to enumerate, which makes their prices fluctuate instantaneously and continuously. Investing in stocks is one of the most important investment decisions faced by investors. Deciding whether to buy or sell shares is not an easy task as it is related to an uncertain future. Therefore, it has become necessary to make predictions about stock prices in the future, so that the investor can be guided in making his investment decision. The predictive methods used varied and ranged from simple methods that depend on personal estimates to those that rely on statistical and mathematical methods. The autoregressive model and the moving average (ARIMA) were used in (1987) to predict stock indices [1], the multiple regression model was also used in (1990) to predict the direction of the market index [2], and the autoregressive conditional heteroskedasticity model was used in (2005) to predict the fluctuations of stock returns [3]. Despite the results achieved by these methods, they failed to model some time series of stock prices, in addition to requiring the time series to be stable in order to predict them. As a result, there has been an interest in using methods based on machine learning and artificial intelligence as improved methods. Some machine learning techniques were used (2007) to predict stock prices [4], and the support vector regression model was used (2013) to predict the direction of price movement [5]. Artificial neural networks are one of the techniques of artificial intelligence, as its origins go back to (1940) when McCulloch and Pitts developed a computational model of the neural network [6]. Artificial neural networks have been used to solve numerous problems such as classification, processing, and clustering, as well as time series prediction. It has recently been widely used in forecasting stock returns and capital market fluctuations due to its speed and ease of data processing. This paper proposes an analytical study to test artificial neural networks' ability to predict closing prices for top-six traded industrial stocks listed on Iraq Stock Exchange (ISX). The main goal of this work is to develop predictive models that can be used to guide investment decisions. To achieve that, the paper was organized as follows. Section (2) covered the literature reviews of related works. Section (3) provides a brief knowledge of artificial neural networks. Section (4) presented the methodology and data of this study. Section (5) showed the results and discussion of the experimental study. Finally, Section (6) summarized the conclusion of the study.

There are several works that experimented with neural networks for stock prediction. Guresen et al (2011) evaluated a Multi-layer perceptron neural network (MLP) along with a dynamic artificial neural network (DAN2) and GARCH model in stock prediction of the NASDAQ index [7]. Bing et al (2012) applied Backpropagation neural network to predict the Shanghai stock exchange composite index. The empirical study conducted on the Shanghai stock exchange composite index is predictable in the short term [8]. Yetis et al (2014) used generalized feedforward neural network model to predict the NASDAQ index, the results demonstrated good performance [9]. Chen et al (2015) evaluated various techniques of machine learning such as LSTM Neural networks, Support vector machines, and Genetic algorithms for predicting Chain stock returns. The results proved the power of LSTM in sequence learning for predicting China's stock market [10]. Billah et al (2017) experimented with ANN based model with an improved Levenberg Marquardt (LM) algorithm compared with the Adaptive Neuro-Fuzzy Inference System (ANFIS) to predict the close price. Comparison results showed that the LM algorithm can predict the close price with less error than ANFIS [11]. Hiransha et al (2018) used four architectures of neural networks, i.e MLP, RNN, LSTM, and CNN for predicting the stock price in NSE and NYSE exchanges. The empirical study demonstrated that CNN is outperforming other architectures. The results obtained have been compared with the ARIM model, It proved that ANN is outperforming the ARIMA model [12]. Teixeira et al (2020) presented a comparative study of five architectures of ANNs, i.e multiple linear regression, Jorden, Elman, Radial basis function, and multilayer perceptron for predicting the six most traded stocks of the Brazilian stock exchange. The results showed that all architectures considered, except RBF, provide suitable reasonable predictions [13]. Shahvaroughi et al (2021) experimented ANN-based model that has been trained using metaheuristic algorithms such as bat algorithm (BA), social spider optimization (SSO), and Genetic algorithm beside ARIMA model to predict stock price indices. The results obtained were compared to each other [14].

3. Artificial Neural Networks Overview

ANN is one of the techniques of machine learning, and its core idea is to try to simulate the biological cells of the human brain and take advantage of its working mechanism in wide fields. Neural networks are used today in the fields of processing, classification, analysis, and prediction [15]. ANN is regarded as a non-linear statistical data tool. The complex relationship between outputs and inputs can be modeled using ANN. The main advantage of ANN is its ability to learn underlying patterns from data, which most conventional methods fail to do [16]. There are many styles of neural networks used in prediction. In this work Multilayer perceptron (MLP) is considered. Figure (1) illustrates the MLP basic architecture.

Figure 1. The basic architecture of MLP.
Figure 1. The basic architecture of MLP.

Multilayer perceptron (MLP) is a feedforward neural network in which data flows unidirectionally from the input layer to the output layer via hidden layers [17]. The layers of the neural network are connected to each other by weights. The activation function of perception in the same layer is the same. It is either a sigmoid or a hyperbolic tangent for the hidden layers in general. The output layer can be a sigmoid or a linear function depending on the application [18]. The role of the activation function is to calculate the response of a neuron, as the weighted inputs can be infinite. Thus deciding whether a neuron should be activated or not, then it bounds the net input value [19]. Backpropagation, which is a generalization of the Least Mean Squared rule, is one of the most wellknown learning algorithms used in MLP [20]. Backpropagation is a weight-correction technique that involves propagating errors from one layer to the next, beginning with the output layer and working backward. The backpropagation algorithm is based on the following five derived equations, which are known as deriving the gradients [21].

❖ Partial derivatives

(1) πœ•πΈπ‘‘ πœ•π‘€π‘–π‘— π‘˜π‘œπ‘– π‘˜βˆ’1 π‘˜= 𝛿𝑗

❖ The error of final layer

( = 𝑔) * (π‘Ž' ()(𝑦.+ βˆ’ 𝑦+) (2) 𝑆'

❖ The error of hidden layer

.!

❖ Adding the partial derivatives of each input-output pair

3 3 (4) πœ•πΈ (𝑋, πœƒ) - = 1 πœ• πœ•π‘€2, - 61 2 (𝑦.+ βˆ’ 𝑦+)48 = 1 𝑁 0 πœ•πΈ+ πœ•π‘€2, 𝑁 0 - πœ•π‘€2, +0' +0'

❖ Updating the weights

- = βˆ’π›Όπœ•πΈ (𝑋, πœƒ) (5) βˆ†πœ•π‘€2, - πœ•π‘€2,

The forward propagation and backward propagation processes are repeated repeatedly in the training process of neural networks to minimize the error function [22]. Once the minimum error function is reached, the training process stops, and the link weights are generalized between the layers [23]. There are several techniques for conditional stopping of the training process, such as early stopping depending number of epochs. Continuing to train does not always guarantee improved results; in fact, it is more likely that the opposite will occur, as increasing training times can lead to overfitting [24].

4. Methodology and Data

4.1 Row Data

Raw data were acquired from Iraq stock exchange (ISX) [25], representing the historical data of top-six traded industrial ISX-listed stocks from (2/1/2019) to (24/12/2020). The data are some daily indices consists seven independent variables, which are Open, High, Low, Present rate, Last rate, Change rate, and Volume as well. The dependent variable is Close price to be predicted.

4.2 Proposed Work

To build MLP model, Matlab 2014b nntool was used [26]. The data were divided into training, testing, and validation sets by 70%, 15%, and 15% respectively, then normalized for training performance enhancement. MLP settings have been set to contain 1000 as maximum epochs, logistic function as activation, Mean squared error as performance metrics, and Levenberg-Marquardt was used as a training algorithm. Table (1) shows MLP settings.

Table 1. MLP model settings
Table 1. MLP model settings

Several attempts were made to determine the optimal neural network architecture. Experiments have revealed that the best architecture consists of a single input layer including (8) neurons representing inputs, a single hidden layer with (10) neurons, and a single output representing predicted closing price. Figure (2) shows the MLP model architecture.

Figure 2. MLP model settings.
Figure 2. MLP model settings.

5. Results and Discussion

To evaluate the performance of predictive models, some statistical metrics were used. The six MLP models are subjected to Mean squared error (MSE), Root mean squared error (RMSE), and R squared (R2). Their formulas are shown as follows.

βˆ‘$ %&# (7% 9 :%)' 3 (3) 𝑀𝑆𝐸= 𝑅𝑀𝑆𝐸= =βˆ‘$ %&# (7% 9 :%)' 3 (4)

Here, Oi refers to the actual closing price; Fi refers to the predicted closing price; and N refers to the sample.

<βˆ‘$ %&# (=%9 =>%)'?/3 𝑅4 = 1 βˆ’ %&# (=%9 =>%)'B/3                                                              (5) Aβˆ‘$

Here, N refers to the total number of sample; yi and Ε·i represent the actual price and predicted price respectively; Θ³i refers to the mean of actual price.

Table 2. Model performance analysis
Table 2. Model performance analysis

Table (2) shows the results of evaluating the performance of used MLP models for each stock. Although the length of the stock time series varies, the results clearly demonstrated the high accuracy of the models. It is clear from the results that Al-Hilal Co. stock model was the most accurate with (5.64E-06) MSE, (0.002) RMSE, and (0.99) R2. Chemical & Plastic Co. stock model was the last place in model accuracy with (2.78E-04) MSE, (0.016) RMSE, and (0.99) R2. In general, the results proved that all models are highly accurate, where MSE and RMSE metrics near zero for each. On the other hand, for all, the R2 was close to one. Figure (3) illustrates the regression curve of the models.

(A) Metallurgical & bicycle industry (B) Kendiy vaccines

Figure
Figure

(C) Dates packaging & marketing (E) Al-Hillal industry

Figure
Figure

(E) Baghdad soft drinks (F) Chemical and plastic industry

Figure 3. Regression curves of models.
Figure 3. Regression curves of models.

Figure (4) below shows the predicted values versus the actual values. It shows how well the predicted values match the actual ones for all stocks. This proves the accuracy of the models.

Figure

(A) Metallurgical & bicycle industry

(B) Kendiy vaccines

Figure

(C) Dates packaging & marketing

(D) Al-Hillal industry

Figure 4. Comparing predict values and actual values.
Figure 4. Comparing predict values and actual values.

(E) Baghdad soft drinks

(F) Chemical and plastic industry

6. Conclusion

Decision making for investing in stocks is a complex challenge that investors face. As a result, it necessitates making future predictions to serve as a guide. Because of the rapid fluctuations in stock prices, most traditional models fail to predict them. In this paper, we propose an artificial neural network-based model for predicting the closing prices of top-six traded industrial ISX-listed stocks. ANN have the advantage of not requiring any prerequisites for time series stability. Experimentation has shown that increasing the training times improves model accuracy, but not always, as overfitting can occur. The empirical study demonstrated neural networks' high accuracy in time series modelling of closing prices for six stocks. This confirms the feasibility of using neural networks to predict stock prices on the Iraqi Stock Exchange, and thus their use in investment decision making. We recommend experimenting with other ANN architectures and adding multiple variables in the future..

Funding: β€œThis research received no external funding”

Conflicts of Interest: β€œThe authors declare no conflict of interest.”

References

[1] I. Virtanen and P. Yli-Olli, “Forecasting stock market prices in a thin security market,” Omega, vol. 15,

no. 2, pp. 145–155, 1987.

[2] T. C. E. Cheng, Y. K. Lo, and K. W. Ma, “Forecasting stock price index by multiple regression,” Manag.

Financ., 1990.

[3] J. Marcucci, “Forecasting stock market volatility with regime-switching GARCH models,” Stud.

Nonlinear Dyn. Econom., vol. 9, no. 4, 2005.

[4] V. H. Shah, “Machine learning techniques for stock prediction,” Found. Mach. Learn. Spring, vol. 1, no.

1, pp. 6–12, 2007.

[5] Y. Xia, Y. Liu, and Z. Chen, “Support Vector Regression for prediction of stock trend,” in 2013 6th

international conference on information management, innovation management and industrial

engineering, 2013, vol. 2, pp. 123–126.

[6] R. Nayak, L. C. Jain, and B. K. H. Ting, “Artificial Neural Networks in Biomedical Engineering: A

Review,” in Computational Mechanics–New Frontiers for the New Millennium, S. Valliappan and N.

Khalili, Eds. Oxford: Elsevier, 2001, pp. 887–892.

[7] E. Guresen, G. Kayakutlu, and T. U. Daim, “Using artificial neural network models in stock market

index prediction,” Expert Syst. Appl., vol. 38, no. 8, pp. 10389–10397, 2011, doi:

10.1016/j.eswa.2011.02.068.

[8] Y. Bing, J. K. Hao, and S. C. Zhang, “Stock Market Prediction Using Artificial Neural Networks,” Adv.

Eng. Forum, vol. 6–7, pp. 1055–1060, 2012, doi: 10.4028/www.scientific.net/aef.6-7.1055.

[9] Y. Yetis, H. Kaplan, and M. Jamshidi, “Stock market prediction by using artificial neural network,”

World Autom. Congr. Proc., pp. 718–722, 2014, doi: 10.1109/WAC.2014.6936118.

[10] K. Chen, Y. Zhou, and F. Dai, “A LSTM-based method for stock returns prediction: A case study of

China stock market,” Proc. - 2015 IEEE Int. Conf. Big Data, IEEE Big Data 2015, pp. 2823–2824,

2015, doi: 10.1109/BigData.2015.7364089.

[11] M. Billah, S. Waheed, and A. Hanifa, “Stock market prediction using an improved training algorithm of

neural network,” ICECTE 2016 - 2nd Int. Conf. Electr. Comput. Telecommun. Eng., no. December, pp.

8–10, 2017, doi: 10.1109/ICECTE.2016.7879611.

[12] M. Hiransha, E. A. Gopalakrishnan, V. K. Menon, and K. P. Soman, “NSE Stock Market Prediction

Using Deep-Learning Models,” Procedia Comput. Sci., vol. 132, no. Iccids, pp. 1351–1362, 2018, doi:

10.1016/j.procs.2018.05.050.

[13] R. Mathur, V. Pathak, and D. Bandil, Emerging Trends in Expert Applications and Security, vol. 841.

Springer Singapore, 2019.

[14] M. Shahvaroughi Farahani and S. H. Razavi Hajiagha, Forecasting stock price using integrated artificial

neural network and metaheuristic algorithms compared to time series models, vol. 25, no. 13. Springer

Berlin Heidelberg, 2021.

[15] Marwan Abdul hameed Ashour, Artificial neural networks and methods of times series forecasting, 1st

ed. Al-thakera, 2018.

[16] G. Zhang, B. E. Patuwo, and M. Y. Hu, “Forecasting with artificial neural networks:: The state of the

art,” Int. J. Forecast., vol. 14, no. 1, pp. 35–62, 1998.

[17] C. M. Bishop, Neural networks for pattern recognition. Oxford university press, 1995.

[18] M. T. Camacho Olmedo, M. Paegelow, J. F. Mas, and F. Escobar, Geomatic Approaches for Modeling

Land Change Scenarios. An Introduction. 2018.

[19] “Activation Function,” GeeksForGeeks, 2019. https://www.geeksforgeeks.org/activation-functions/.

[20] K.-L. Du and M. N. S. Swamy, Neural networks and statistical learning. Springer Science & Business

Media, 2013.

[21] C. W. John McGonagle, George Shaikouski, “Backpropagation,” 2022.

https://brilliant.org/wiki/backpropagation/.

[22] S. M. Karazi, M. Moradi, and K. Y. Benyounis, Statistical and Numerical Approaches for Modeling and

Optimizing Laser Micromachining Process-Review. Elsevier Ltd., 2019.

[23] D. K. Chaturvedi, Modeling and simulation of systems using MATLAB® and Simulink®. CRC press,

2017.

[24] X. Ying, “An overview of overfitting and its solutions,” in Journal of Physics: Conference Series, 2019,

vol. 1168, no. 2, p. 22022.

[25] Iraqi Securities Commission, “Iraq Stock Exchange (ISX),” 2022. http://www.isx-iq.net.

[26] C. B. Moler, “MathWorks MATLAB 2014b,” 2014. https://www.mathworks.com/.