Design Analysis and Implementation of Stock Market Forecasting System Using Improved Soft Computing Technique
Design Analysis and Implementation of Stock Market Forecasting System Using Improved Soft Computing Technique
____________________________________________________________________________________________________________________
Abstract
In this paper, a stock market prediction model was created utilizing artificial neural networks. Many people nowadays are attempting to predict
future trends in bonds, currencies, equities, and stock markets. It is quite challenging for a capitalist and an industry to forecast changes in
stock market prices. Due to the numerous economic, political, and psychological aspects at play, forecasting future value changes on the stock
markets is quite challenging. In addition, stock market forecasting is a difficult endeavor because it relies on a wide range of known and
unknown variables. Many approaches, including technical analysis, fundamental analysis, time series analysis, and statistical analysis are used
to attempt to predict the share price; however, none of these methods has been demonstrated to be a consistently effective prediction tool.
Artificial neural networks (ANNs), a subfield of artificial intelligence, are one of the most modern and promising methods for resolving
financial issues, such as categorizing corporate bonds and anticipating stock market indexes and bankruptcy (AI). Artificial neural networks
(ANN) are a prominent technology used to forecast the future of the stock market. In order to understand financial time series, it is often
essential to extract relevant information from enormous data sets using artificial neural networks. An outcome prediction neural network with
three layers is trained using the back propagation method. Analysis shows that ANN outperforms every other prediction technique now
available to academics in terms of stock market price predictions. It is concluded that ANN is a useful technique for predicting stock market
movements globally.
____________________________________________________________________________________________________________________
very soon while some investors stay away from decreasing putting their money in the stock market. But it is challenging
shares as they panic about that these share will go to decay. since there are so many considerations. There are therefore
There is no doubt that the forecasting of the stock market is many methods for predicting share price change. The main
an out of the ordinary task. So there are a number of goal of this paper is to anticipate stock price indices using an
techniques those are useful to achieve this task as follows: artificial neural network (ANN) trained with novel
metaheuristic algorithms as the social spider optimization
• Technical Analysis Methods
(SSO) and bat algorithm (BA). We made use of various
• Fundamental Analysis Methods
technical indicators as input variables. Then, we employed
• Traditional Time Series Prediction Methods
evolutionary algorithms as a heuristic method for feature
• Machine Learning Methods
selection and choosing the best and most relevant indicators
(GA). We used a variety of loss functions, such as mean
2. OBJECTIVE absolute error, as a standard for evaluating errors (MAE). On
In The applications of ANN in different prediction the other hand, using time series models like ARMA and
problems have been a hot research topic for many years ARIMA, we predicted stock price. Finally, we compared the
and continuously growing. Though, in India not so much of results obtained utilizing ANN-Metaheuristic approaches and
works have done in this field if we compare it with other time series models. [2]
countries. Therefore, the objective of this work is: (Mehtabhorn Obthong, G. Wills, and N. Tantisantiwong,
• To develop artificial neural network (ANN) models for 2020). Stock traders need fast information at their disposal in
stock market prediction. order to make informed judgments. A stock market trades a
• To observe and to examine that the neural network can range of stocks, therefore several factors might affect the
be the applied as an effective tool for the prediction of decision-making process. Additionally uncertain and difficult
stock market future price index. to predict is the behavior of stock prices. These elements
• To perform evaluation of the formulated models for make stock price forecasting both an important and
daily closing price movements of NSE Nifty 50 Index challenging process. As a result, research efforts are
of India. concentrated on identifying the prediction model that has the
• To perform evaluation of the formulated models for lowest mistake rate and best forecast accuracy. This article
daily closing price movements of NSE Nifty 50 Index analyzes research on machine learning techniques and
of India. algorithms that improve the accuracy of stock price forecasts.
[3]
____________________________________________________________________________________________________________________
active, and extremely active phases, the expected impacts of training set. The usage of neural networks as a preferred
the same securities at various points in time are compared. method over other conventional models of prediction is
We find that for most data source combinations, the more promoted by a number of distinguishing characteristics.
active the stock is, the more accuracy we are able to achieve, Therefore, neural networks are more accurate at predicting
demonstrating that our technique is more effective in stock market returns than other models . Consequently, the
forecasting stock price movements during active and highly following are the main reasons to use ANN in stock market
busy times. [4] prediction:
(U. Singh, G. Kumar, and Sanjeev Jain, 2020) The social •Since stock market data are very difficult to represent and
and economic foundation of a country depends on the stock extremely complicated, a non-linear model is necessary.
market. Stock market forecasting is one of the most •A large number of connected input nodes are frequently
challenging challenges for investors, professional analysts, required to describe a specific stock, which is ideal for ANN.
and researchers in the financial sector because to the The stock market not only has acknowledged input and
extremely noisy, nonparametric, volatile, convoluted, non- output, but it is also affected by outside knowledge that
linear, dynamic, and chaotic character of stock price time creates ambiguity.
series. Given the increased risk involved in participating in
The ANN approach aims to predict the hidden connections
the stock market, stock market forecasting is a crucial
between input and output, reducing the possibility of
responsibility and a well-known study area in the financial
unpredictability and enhancing profit generation. Information
sector. However, the majority of the risk may be minimized
of the sort called noise does not fall within this category.
with the advancement of very powerful computational
Figures 4.1 and 4.2, respectively, provide illustrations of the
technology. This in-depth investigation focuses on the
stock market prototype and the use of ANN for the stock
application of computationally intelligent stock market
market.
forecasting approaches, such as artificial neural networks,
fuzzy logic, genetic algorithms, and other evolutionary
methods. This paper reviews the current research on
computationally intelligent stock market forecasting
methods. The chosen papers are organized and discussed in
this article from the standpoints of six main areas: (1) the
stock market under investigation and the related dataset, (2) Figure 4.1 Depiction of Stock Market
the type of input variables investigated, (3) the pre-processing
techniques used, (4) the feature selection techniques to select
effective variables, (5) the forecasting models to address the
stock price forecasting problem, and (6) performance metrics
used to evaluate the models. This work's major contribution
Figure 4.2 Using ANN, Representation of Stock Market
is to provide academics and financial professionals with a
Model
systematic methodology to develop intelligent stock market
forecasting algorithms. This study also describes upcoming Research Methodology
work that will increase the efficiency of the techniques now Research Methodology is a technique by which one can
in use. [5] discover the solution of a specified problem called research
4. PROPOSED METHODOLOGY problem.
The objective of this work is to forecast the stock market Our research problem can be partitioned in two portions, as:
using ANN. Neural networks acquire knowledge through 1. Data accrue and analysis
repeated iterations of input data (called training period). 2. Neural Networks toolbox of MATLAB software is
Although there is a lot of noise in the training set, ANNs are used for training purpose
capable of carrying hidden and non-linear interdependencies. Material and Methods
Without making strict assumptions about the distribution of
The research data set encompassed in this study is the daily
samples, the ANN model also displays complicated and non-
closing prices movement in NSE (National Stock
linear relationships (Bishop, 1995; Breiman, 1984) and can
Exchange) Nifty 50 Index. The whole data set includes
recognize new samples even if they haven't been in the
11
IJFRCSCE | December 2022, Available @ http://www.ijfrcsce.org
International Journal on Future Revolution in Computer Science & Communication Engineering (IJFRCSCE)
ISSN: 2454-4248 Volume: 8 Issue: 4
DOI: https://doi.org/10.17762/ijfrcsce.v8i4.2110
Article Received: 28 August 2022 Revised: 20 October 2022 Accepted: 25 October 2022 Publication: 02 November 2022
____________________________________________________________________________________________________________________
th st forecast the price index fluctuation of stock market we used
the periods from 4 January, 2010 to 31 March, 2016.
three layered feedforward neural network model where
The entire cases are 1538 trading days.
input layer linked to the hidden layer and hidden layer
The stock market data used in this research was obtained further joined to an output layer. Three neurons of the input
from World Wide Web. The data obtained from historical layer represent the input for the network as FII inflow, FII
data offered on the website of National Stock Market. We outflow and Exchange rate. A single neuron indicates the
got the initial original data in the form of soft copy .csv output which shows the way of movement. The output is
format. either 0 or 1. Based on the heuristic, the quantity of
We have finally made a file that included all the daily neurons in the hidden layer was decided. Figure 4.3 reveals
closing prices of index in that particular time period, which the structural design of three layered feedforward ANN
is showing selected data fields. The performance of the model.
neural network is directly affected by ANN models. So to
model a neural network a number of critical issues like:
recognition of input-output variables, selection of
parameters, network structural designing and statistics for
performance evaluation are measured carefully.
Four technical indicators are applied as input and output
variables for each case and we categorized them as
independent variables and dependent variable in models
development process. F o l l o w i n g s a r e shows that
dependent and three independent variables.
Figure 4.3 Structural Design of Three Layered
Dependent Variable: Feedforward ANN
Daily closing: Daily closing data of Nifty 50 index Partitioning Strategies Used
Independent Variable: Training and testing data set are two groups in which the
FII inflow: Foreign Institutional Investors gross purchase whole historical data set is divided. To build the ANN
FII outflow: Foreign Institutional Investors gross sales model for training purpose we used training data set and
Exchange rate: USD to IN then applied testing data set to assess how well the ANN
The data of independent variables (FII inflow, FII outflow models act upon prediction by new data set (This data set
and Exchange rate) and dependent variable collected from not used in training of network). After recognition of
the websites respectively and processed in required format. input variables we created three partitioning strategies to
The independent variables are very important because the train and to test ANN models.
closing price values greatly depend on these factors. All st
I Strategy (70%, 30%) symbolized as a. In which 70%
fields hold numeric values as training algorithm needed only
cases are applied in training process while remaining 30%
numeric values. So, we converted the values of dependent
cases in testing process from total of 1538 cases.
variable (Daily closing) in whole numbers using ‘roundup’
function offered by MS Excel 2007/CSV because if we nd
II Strategy (75%, 25%) symbolized as b. In which
express this field in decimal values then algorithms are not 75% cases are applied in training process while remaining
capable to understand the pattern correctly as we desire. It 25% cases in testing process from total of 1538 cases.
demonstrates selected data with understandable
rd
identification of dependent and independent variables. III Strategy (80%, 20%) symbolized as c. In which
80% cases are applied in training process while remaining
Artificial Neural Network Model Development
20% cases in testing process from total of 1538 cases.
ANN may be defined as an enormous parallel disseminated
Network Training/Learning
connection which consists of neurons that storing
knowledge. ANN has the capability to procure meaning Training is very crucial part for any prediction model. In
from indefinite or complex data that can be worked to infer neural network, training is a repetitive progression of
patterns and identify trends those are excessively intricate to discontinuous upsurge of bias and network weights. To train
observe by any computer approaches or human beings. To neural network models, a text file created in which training
12
IJFRCSCE | December 2022, Available @ http://www.ijfrcsce.org
International Journal on Future Revolution in Computer Science & Communication Engineering (IJFRCSCE)
ISSN: 2454-4248 Volume: 8 Issue: 4
DOI: https://doi.org/10.17762/ijfrcsce.v8i4.2110
Article Received: 28 August 2022 Revised: 20 October 2022 Accepted: 25 October 2022 Publication: 02 November 2022
____________________________________________________________________________________________________________________
(input) data set and corresponding testing (output) data set
organized using above stated strategies. In the training
process two sets of variables of training data are used
as training or input variable (‘q’) and target variable (‘r’).
By a space the values of variable are separated while
semicolon (;) are used at the end for separation of each input
data.In whole training process cycle input data set [q1, q2,
q3, q4…….] is provided to input node and accordingly the
values of target data set is provided to output node. An error
signal is generated when network output is compared with
target/ desire output. A control system is trigged by error Figure 5.1 Design of Training Algorithm
signal which implements a sequence of corrective Figure 5.1 indicates the design of neural network architecture
modification for neurons weights and biases in each step of and learning model for the proposed system the network has
repetitive training process. Neural network has been trained been designed using gradient descent learning along with
after several iterations and the weights are saved. Now in momentum. The network has been trained with training,
trained neural network, we provided the testing data set for testing and validation to assess the accuracy of the proposed
checking the network behavior. After modification in the system. Figure 5.2 indicates the design of layers of neural
network weights, the result is used to inspect the network network model for the proposed system the network has been
capability for prediction of output. designed using feed forward architecture with custom layers.
Performance Evaluation Criteria There are seven features which are considered as input layer
for the proposed system. Similarly there is one hidden layer
For neural network model, prediction accuracy is
and one output layer which has been used to assess the
evaluated using Root mean square error (RMSE).
forecasted value. The network has feed forward architecture.
RMSE (Root mean square error) RMSE provides the
residual error in accordance with MSE (mean square error).
It is used to assess the performance of developed model.
5. RESULT ANALYSIS
The dataset was downloaded in csv format from yahoo
finance and kaggle and contains information on stock
performance over the last five years. The goal of this Figure 5.2 Layers of Neural Network
statistical research was to see if there was a link between
multiple price indicators and the share's closing price. For
this, a neural network model was used. The opening price,
high price, and low price are all good predictors of the closing
price, according to a lot of evidence. It's striking that volume
has no statistical importance in determining the closing price.
Obtaining a Daily stock preparation set of data model fitting
and cross-validation Visualization The model's evaluation
The end result is Predicted Price Visualization.
Step 1. Loading Data
Step 2. Obtaining Daily Price Data
Step 3. Fitting Model and Valuation
Step 4. Visualization of Results
Step 5. Parameter Evaluation
Step 6. Output: Predicted Price Visualization
____________________________________________________________________________________________________________________
The data was downloaded in csv format from yahoo finance
and kaggle, and it includes stock performance data for the
previous five years. The purpose of this statistical study was
to examine if there was any correlation between numerous
price indicators and the closing price of the stock.
____________________________________________________________________________________________________________________
been demonstrated that ANN is an effective, all- Science, Volume 167, 2020, Pages 599-606, ISSN 1877-
encompassing method for pattern recognition, classification, 0509.
clustering, and notably for time series prediction with a high [2]. Shahvaroughi Farahani, Milad and Seyed Hossein Razavi
Hajiagha. “Forecasting stock price using integrated
degree of accuracy. In this paper, we made an effort to
artificial neural network and metaheuristic algorithms
achieve an optimum structural design for ANN to predict the
compared to time series models.” Soft
daily closing prices movement in NSE Nifty 50 Index of India Computing (2021): 1 - 31.
with high degree of accuracy. It is obvious from the [3]. Obthong, Mehtabhorn, Nongnuch Tantisantiwong,
experiments that the stock prices can be correctly predicted Watthanasak Jeamwatthanachai and Gary B. Wills. “A
by neural network if we provide appropriate data to train the Survey on Machine Learning for Stock Price Prediction:
network. ANN models have been experimented using various Algorithms and Techniques.” FEMIB (2020).
partitions of training patterns and different ANN parameters [4]. Zhou, Zhongbao, Meng Gao, Qing Liu and Helu Xiao.
combinations using MATLAB. The daily data from 2 to “Forecasting stock price movements with multiple data
sources: Evidence from stock market in China.” Physica
April, 2021 have been used as the data set that included a total
A-statistical Mechanics and Its Applications 542
number of 1600 Aprox trading days. Root Mean Square Error
(2020): 123389.
is used to evaluate the performance. The three layered [5]. Kumar, Gourav, Sanjeev Jain and Uday Pratap Singh.
feedforward neural network model trained by “Stock Market Forecasting Using Computational
backpropagation algorithm shows the prediction accuracy of Intelligence: A Survey.” Archives of Computational
89.46% when rearmost 20% cases of data set deployed as test Methods in Engineering (2020): 1-33.
data with learning function “trainoss” of MATLAB. [6]. Ranadev, M. B. ., V. R. . Sheelavant, and R. L. .
Therefore, it is observed that the ANN is an effective tool for Chakrasali. “Predetermination of Performance Parameters
the prediction of stock market. So it can be successfully of 3-Phase Induction Motor Using Numerical Technique
Tools”. International Journal on Recent and Innovation
applied to the forecasting of Nifty 50 daily closing price, as a
Trends in Computing and Communication, vol. 10, no. 6,
result of which both investors as well as regulators can get
June 2022, pp. 63-69, doi:10.17762/ijritcc.v10i6.5628.
attractive benefits. [7]. Sedighi, Mojtaba, Hossein Jahangirnia, Mohsen
Gharakhani and Saeed Farahani Fard. “A Novel Hybrid
Future Scope Model for Stock Price Forecasting Based on
Metaheuristics and Support Vector Machine.” Data 4
As future work, in our study we selected three independent
(2019): 75.
variables for the stock market prediction but other
[8]. Wong, Wk and Chew Ing Ming. “A Review on
international financial factors like CPI (Consumer Price Metaheuristic Algorithms: Recent Trends, Benchmarking
Index), WPI (wholesale Price Index), IIP (Index of Industrial and Applications.” 2019 7th International
Production) and interest rates etc. may also be included as Conference on Smart Computing &
inputs for the model to enhance the accuracy. The current Communications (ICSCC) (2019): 1-5.
study can be further extended by using genetic algorithm or [9]. Liu, Guang and Xiaojie Wang. “A new metric for
fuzzy logic to improve the outcomes. We can also go through individual stock trend prediction.” Eng. Appl. Artif.
deep learning algorithm processes. One may explore the Intell. 82 (2019): 1-12.
[10]. Lv, Dongdong, Shuhan Yuan, Meizi Li, Meizi Li and
possibility of redefining training patterns, by applying n
Yang Xiang. “An Empirical Study of Machine Learning
hidden layers in the architecture for better performance. The
Algorithms for Stock Daily Trading
intended model may also be applied in mutual funds, Strategy.” Mathematical Problems in
exchange rates, interest rates, petrol prices and other financial Engineering (2019).
market forecasting. The preeminent model can be further [11]. Reddy K, Srikanth, Lokesh Kumar Panwar, Bijaya Ketan
programmed and fabricated in a micro-controller and can be Panigrahi and Rajesh Kumar. “Binary whale optimization
used as small Android application. algorithm: a new metaheuristic approach for profit-based
unit commitment problems in competitive electricity
markets.” Engineering Optimization 51 (2019): 369 -
REFERENCES 389.
[1]. Mehar Vijh, Deeksha Chandola, Vinay Anand Tikkiwal, [12]. Ghanbari, Mohammadreza and Hamidreza Arian.
Arun Kumar,Stock Closing Price Prediction using “Forecasting Stock Market with Support Vector
Machine Learning Techniques,Procedia Computer Regression and Butterfly Optimization
Algorithm.” ArXiv abs/1905.11462 (2019).
15
IJFRCSCE | December 2022, Available @ http://www.ijfrcsce.org
International Journal on Future Revolution in Computer Science & Communication Engineering (IJFRCSCE)
ISSN: 2454-4248 Volume: 8 Issue: 4
DOI: https://doi.org/10.17762/ijfrcsce.v8i4.2110
Article Received: 28 August 2022 Revised: 20 October 2022 Accepted: 25 October 2022 Publication: 02 November 2022
____________________________________________________________________________________________________________________
[13]. Saravanan, R.. “Social Spider Optimization with Framework Based on Whale Swarm Algorithm and
Tumbling Effect Based Data Classification Model for Artificial Neural Network in Cloud
Stock Price Prediction.” International Journal of Computing.” Intelligent Computing &
Innovative Technology and Exploring Optimization (2018).
Engineering (2019). [23]. Safa, Mozhgan and Hossein Panahian. “P/E Modeling and
[14]. Kabir Ahmed, Muhammed, Gregory Maksha Wajiga, Prediction of Firms Listed on the Tehran Stock Exchange;
Nachamada Vachaku Blamah and Bala Modi. “Stock a New Approach to Harmony Search Algorithm and
Market Forecasting Using ant Colony Optimization Based Neural Network Hybridization.” Iranian Journal of
Algorithm.” American Journal of Mathematical and Management Studies 11 (2018): 769-793.
Computer Modelling (2019). [24]. Sezer, Omer Berat, Murat A. Ozbayoglu and Erdogan
[15]. Joy, P., Thanka, R., & Edwin, B. (2022). Smart Self- Dogdu. “A Deep Neural-Network Based Stock Trading
Pollination for Future Agricultural-A Computational System Based on Evolutionary Optimized Technical
Structure for Micro Air Vehicles with Man-Made and Analysis Parameters.” Procedia Computer
Artificial Intelligence. International Journal of Intelligent Science 114 (2017): 473-480.
Systems and Applications in Engineering, 10(2), 170– [25]. Ghasemiyeh, Rahim, Reza Moghdani and Shib Sankar
174. Retrieved from Sana. “A Hybrid Artificial Neural Network with
https://ijisae.org/index.php/IJISAE/article/view/1743 Metaheuristic Algorithms for Predicting Stock
[16]. Sahoo, Sipra and Mihir Narayan Mohanty. “Stock Market Price.” Cybernetics and Systems 48 (2017): 365 - 392.
Price Prediction Employing Artificial Neural Network [26]. Chen, Yingjun and Yongtao Hao. “A feature weighted
Optimized by Gray Wolf Optimization.” Advances in support vector machine and K-nearest neighbor algorithm
Intelligent Systems and Computing (2019). for stock market indices prediction.” Expert Syst.
[17]. Pal, Shanoli Samui and Samarjit Kar. “Time series Appl. 80 (2017): 340-355.
forecasting for stock market prediction through data [27]. André Sanches Fonseca Sobrinho. (2020). An Embedded
discretization by fuzzistics and rule generation by rough Systems Remote Course. Journal of Online Engineering
set theory.” Math. Comput. Simul. 162 (2019): 18-30. Education, 11(2), 01–07. Retrieved from
[18]. Zaman, Shafir. “Weak form market efficiency test of http://onlineengineeringeducation.com/index.php/joee/art
Bangladesh Stock Exchange: an empirical evidence from icle/view/39
Dhaka Stock Exchange and Chittagong Stock [28]. Chen, Yingjun and Yijie Hao. “Integrating principle
Exchange.” Journal of Economics, Business & component analysis and weighted support vector machine
Accountancy Ventura (2019). for stock trading signals
[19]. Goli, Alireza, Hassan Khademi Zareh, Reza Tavakkoli- prediction.” Neurocomputing 321 (2018): 381-402.
Moghaddam and Ahmad Sadeghieh. “A comprehensive [29]. Hu, Hongping, Li Tang, Shuhua Zhang and Haiyan Wang.
model of demand prediction based on hybrid artificial “Predicting the direction of stock markets using optimized
intelligence and metaheuristic algorithms: A case study in neural networks with Google
dairy industry.” Journal of Industrial and Systems Trends.” Neurocomputing 285 (2018): 188-195.
Engineering 11 (2018): 190-203. [30]. Rouf, N.; Malik, M.B.; Arif, T.; Sharma, S.; Singh, S.;
[20]. Chou, Jui-Sheng and Thi-Kha Nguyen. “Forward Forecast Aich, S.; Kim, H.-C. Stock Market Prediction Using
of Stock Price Using Sliding-Window Metaheuristic- Machine Learning Techniques: A Decade Survey on
Optimized Machine-Learning Regression.” IEEE Methodologies, Recent Developments, and Future
Transactions on Industrial Informatics 14 (2018): Directions. Electronics 2021, 10, 2717.
3132-3142. https://doi.org/10.3390/ electronics10212717.
[21]. Baek, Yujin and Ha Young Kim. “ModAugNet: A new [31]. Ajinkya Rajkar , Aayush Kumaria , Aniket Raut , Nilima
forecasting framework for stock market index value with Kulkarni, 2021, Stock Market Price Prediction and
an overfitting prevention LSTM module and a prediction Analysis, International Journal Of Engineering Research
LSTM module.” Expert Syst. Appl. 113 (2018): 457- & Technology (IJERT) Volume 10, Issue 06 (June 2021).
480. [32]. Sandhu, O. Stock market trend prediction using regression
[22]. Fahad, Ahmed, Abdulghani Ali Ahmed and Mohd Nizam errors. (2021) https://doi.org/10.32920/ryerson.14645169
Mohmad Kahar. “Network Intrusion Detection
16
IJFRCSCE | December 2022, Available @ http://www.ijfrcsce.org