Equity Market Price Prediction Forecast and Analysis With Technical Indicators and Diversification Analysis Using Deep Learning Technique
Equity Market Price Prediction Forecast and Analysis With Technical Indicators and Diversification Analysis Using Deep Learning Technique
https://doi.org/10.22214/ijraset.2023.51297
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
Abstract: Many experts, analysts, and novice investors have found it challenging to predict valuations of shares. Investors are, in
fact, quite interested in the field of price forecasting for equity study. Many investors are interested in understanding the future
state of the equity market in order to make a smart and profitable investment. By giving helpful information like the equity
market's future direction, good and effective equity market prediction systems assist traders, investors, and analysts. equity
market price forecasting is a challenging undertaking that often necessitates intensive human-computer interaction. For
forecasting share prices, many prediction approaches are available. The foundation of price for shares forecasting and other
financial model forecasts is time series forecasting. More sophisticated time series prediction methods are necessary when share
prices become less linear. The predictability of current systems is insufficient. In this research, we suggest using the LSTM Deep
Learning Algorithm for effective equity price forecasting and analysis technique with diversification analysis. When compared to
current equity price prediction systems, this will produce more accurate findings.
Keywords: LSTM, Deep Learning, Finance, equity Price Prediction
I. INTRODUCTION
The equity market has a reputation for being unpredictable, random, and volatile. It is a chaotic environment with an unbelievable
amount of constantly changing data, which makes it challenging to anticipate the future and take profitable action based on those
predictions. In fact, it is among the most difficult challenges in times series forecasting.
The primary objective of this project is to examine and use deep learning techniques on the equity market to forecast equity
behavior and Users should be given a thorough study of the chosen equity, along with the expected price, technical evaluation plots
with strategy using statistics data. The program will generate a report with all the pertinent analysis, including the forecasted value
and technical evaluation plots, once the user has chosen the required stock and date range. This tool's goal is to empower investors
with information and expertise about the stocks they have picked, enabling investors to make wise selections. accordingly, take their
predictions with a grain of salt and to reduce investing risk and make money, act on such projections. Transfer learning will be used
to accomplish the goal in order to benefit from neural network models that have already been created. Then, predictions are
evaluated using real historical stock price data. The efficient-market theory contends that equity prices are an accurate reflection of
all information that is currently known, and that any price fluctuations that don't depend on newly disclosed information are thus
intrinsically unexpected. This research will be a useful tool to help novice traders make better selections. Many tools will be
employed to accurately achieve the aims of this research. Google Colab and PyCharm (Software) is an excellent place to start,
especially for novices, because it allows you to quickly develop several discover which ones work best in the case of time series
forecasting and employing ARIMA Model to do some analysis techniques such as trending and technical evaluation. After careful
consideration of the model and languages to be used, it has been decided that Python will be the programming language to be used
for implementation. This is because of Python's adaptability, the availability of ready-made models, and the availability of open-
source libraries that are especially helpful in achieving our objectives and possibly even improving results. The LSTM model, which
stands for Long Short-Term Memory, is unquestionably the most fitting model (the one that produces the best results) in the case of
time series forecasting, and it will also be covered in this paper. Its superior performance versus a traditional deep neural network is
the result of the addition of a memory component, which is essential for time series predictions.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4462
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
II. MOTIVATION
Equity market price prediction is essentially described as attempting to calculate equity value and provide a solid framework for
understanding and forecasting the market and equity prices. The dataset's quarterly financial ratio is typically used to present it. As a
result, depending on a single dataset alone may not be adequate for making a forecast and may produce erroneous results. As a
result, we are thinking of researching Deep Learning algorithm and integrating different information to forecast market and equity
patterns.
If a better equity market price prediction algorithm is not put forth, the issue with calculating the equity price will continue to be a
concern. It's challenging to forecast how the equity market will behave. The opinions of thousands of investors typically influence
how the equities market moves. Predicting the price of the equities market requires the capacity to foresee how current events will
affect investors. These occurrences may be political, such as a political leader's speech or news of a swindle. It may also be a global
event, such as a sudden change in the value of a currency or a commodity, etc. All of these things have an impact on business
earnings, which in turn have an impact on investor mood. Almost no investor has the capacity to regularly and correctly predict
these hyperparameters. Prediction of share prices is particularly difficult due to all of these factors. Once the appropriate data is
gathered, it can be utilized to programme a machine and provide a forecast. Once the correct data is gathered, it can be utilised to
train a machine and produce a predictive outcome.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4463
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
IV. METHODOLOGY
A. LSTM (Long Short-Term Memory)
LSTM is a deep learning model that is commonly used in the field of natural language processing, time series forecasting, speech
recognition, and image classification. It is a type of recurrent neural network (RNN) that is designed to address the vanishing
gradient problem, which occurs when RNNs are unable to effectively propagate error gradients over time. LSTM has the ability to
selectively remember or forget previous inputs based on their relevance to the current output, allowing it to maintain long-term
dependencies in sequential data. It consists of a memory cell, an input gate, an output gate, and a forget gate, each of which controls
the flow of information within the network. The LSTM model has proven to be effective in a variety of applications, including
language translation, sentiment analysis, and speech recognition. It has also been used in predictive maintenance, financial
forecasting, and other areas that involve time-series data. Overall, LSTM is a powerful deep learning model that is well-suited for
tasks that involve sequential data and long-term dependencies.
1) Structure of LSTM
a) Input Gate
b) Forget Gate
c) Output Gate
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4464
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
A rudimentary neural network applies a sigmoid function on the current information in order to thoroughly change it before adding
new input. This results in an overall modification of the material. Therefore, there is no differentiation between "important" and "not
so important" information. On the other hand, LSTMs add and multiply information in little amounts to produce modest changes.
Cell states are a technique used by LSTMs to transmit information. In this manner, LSTMs are able to selectively recall or forget
information.
Different memory units known as cells make up an average LSTM network. Both the cell state and the hidden state are being passed
to the following cell. The memory blocks are in charge of storing information, and there are three main gates that may be used to
manipulate this memory:
C. Forget Gate
Information is taken out of the cell state via a forget gate. Information that is no longer necessary for the LSTM to grasp anything or
that is less significant is eliminated. Two inputs—h_t-1 and x_t—are required by this gate. X_t is the input at that specific time step,
while h_t-1 is the hidden state from the preceding cell or its output. A bias is applied after multiplying the inputs with the weight
matrices. After then, this value is subjected to the sigmoid function. A vector with values ranging from 0 to 1, one for each number
in the cell state, is the result of the sigmoid function. Fundamentally, the sigmoid function determines which values to save and
which to throw away. When the forget gate outputs a '0' for a specific value in the cell state, it signifies that the forget gate wants the
cell state to fully forget that particular piece of information. A "1" denotes the forget gate's desire to recall the complete piece of
data, in a similar manner. The sigmoid function's vector output is multiplied by the cell state.
D. Input Gate
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4465
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
Information is added to the cell state by the input gate. According to the above figure, this information addition is essentially a three-
step procedure. 1) Using a sigmoid function to control which values should be added to the cell state. This functions as a filter for all
the data from h_t-1 and x_t and is essentially very similar to the forget gate. 2) Building a vector that contains all values that might
be added to the cell state (as determined by h_t-1 and x_t). A tanh function, which returns values between -1 and +1, is used for this.
3) Multiplying the regulatory filter's value by the sigmoid gate, creating a vector, and then adding this by using addition, important
information is added to the cell's state. We make sure that only information that is significant and not redundant is added to the cell
state when this three-step procedure is complete.
E. Output Gate
The output gate is in charge of determining whatever relevant data from the current cell state should be shown as an output. Again,
the operation of an output gate may be divided into three steps: 1. Making a vector after scaling the cell state's values to lie between
-1 and +1 using the tanh function. 2. Using the values of h_t-1 and x_t to design a filter that can control the values that must be
produced from the vector previously built. The sigmoid function is used in this filter once again. 3. Adding this regulatory filter's
value to the vector made in step 1, multiplying it, and sending the result both to the next cell's concealed state and as an output.
F. Our Dataset
The data contains records about the Equity price of IT Leading company such as Reliance Industries Limited
Reliance Industries Limited :
https://finance.yahoo.com/quote/RELIANCE.NS/history
The dataset also includes a date-specific value of equity with open, closing, high, and low prices, as well as information on the
volume and turnover of transactions that day. Here, we make a forecast using a close value. The Close Value is the final output value
that will be forecasted using the Deep Learning model at last, using the LSTM Deep Learning method, compare closed real values
with close predicted values.
V. PROPOSED WORK
A. Proposed Algorithm is given below
1) Step 1: The Libraries Being Imported
2) Step 2: Approaching Data Visualisation for Equity Market Price Prediction
3) Step 3: The Data Frame Shape should be printed to check for Null Values.
4) Step 4: Making the Target Variable and the Features Choices
5) Step 5: Making a Training and Testing Set for the Prediction for Equity Market Price
6) Step 6: Developing the LSTM Model for Equity Market Price Prediction
7) Step 7: training with models for Equities market price prediction
8) Step 8: Price Prediction for LSTM
9) Step 9: LSTM model comparison of predicted and actual close prices, 30-day projection, trend and technical analysis, and
diversification analysis.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4466
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4467
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
Data with a batch size of 10 and 50 epochs were used to create the graph in figure 8 above. A red line shows the tested anticipated
closing price, a blue line shows the original close price, and a green line shows the forecast. How much of an improvement the
LSTM-based model has is seen by the gap between these three lines. After a considerable period of time, the projection approaches
the initial closure price. As it learns more, the system will acquire more accuracy.
Figure 9 shows a value for the following day as well as a forecast of the close price based on the close price of the previous graph.
The financial markets are far harder to forecast than the weather is. Actually, it's incredibly difficult to even explain previous
performance in the market. It is an effort to predict the future value of a single stock, a certain market sector, or the market in
general.
C. Trend Analysis
Fig 11. Trend analysis based on the equity market price prediction
Were used to create the Pie Chart in figure 10 above The Reliance Industries Limited Equity was among the top gainers for around
21.9% of the 08-year period and among the top losers for an additional 27.6% of the time. On any given day, the stock has had a
positive performance for around 4.1% of the time period. Likewise, the Equity's price only changed very slightly over the majority
of the time (about 0.2%)
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4468
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
D. Technical Analysis
1) SMA crossover
Fig 12. Technical indicator SMA with buy/sell signal based on the price.
Were used to create the Bar Graph in figure 11 above SMA cross Utilising OHLCV data, the technical indicators. Specifically, it
refers to the volume, high, low, and open of trading. These stock metrics can be used to generate technical indicators. We can make
better investing decisions with the aid of the technical indicators. The 50-day simple moving average for) Reliance Industries
Limited (RELIANCE.NS) is estimated to be somewhere around 2500.01. This indicates that during the last 50 days,
RELIANCE.NS average price was around Rs. 2500.01. The simple moving average (SMA), a popular technical analysis technique,
determines the average price of an asset over a given time period, often 20, 50, or 200 days. This smooths out price movement.
2) EMA crossover
Fig 13. Technical indicator SMA with buy/sell signal based on the price.
Were used to create the Bar Graph in figure 12 above EMA crossover. A moving average that lends more weight to more current
data in the time series while simultaneously accounting for previous data is the exponential moving average (EMA). The smoothing
factor used to compute the EMA gives more weight to recent data points. As a result, it may be more sensitive to fluctuations in
price than a simple moving average (SMA). We generated the 50-day EMA and showed it below along with the RELIANCE.NS
closing price. On the basis of the EMA's crossing with the closing price, we also added buy and sell signals.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4469
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
A purchasing signal is shown when the closing price crosses above the EMA, and a selling signal is indicated when the closing price
crosses below the EMA. that can be used to evaluate stock prices, and that in order to make wise trading decisions, it should be used
in conjunction with other indications and fundamental research.
E. Correlation Analysis
Figure 13 above we do not want the equities to be connected to one another whenever we diversify our portfolio. The Pearson's
correlation coefficient between any two equities should be close to zero mathematically. The theory behind it is straightforward: if
your portfolio contains companies that are highly linked, you run the danger of losing all of your investment if one declines. For the
purpose of the correlation study, I used the previously mentioned stocks. These stocks come from a variety of industry and market
cap groups.
Regarding demonstrated evaluation metrics that display the outcome of where project datasets RELIANCE.NS. and data that has
been trained and tested, where batch size 10 and Epoch 50. The value listed above represents the test value.
(RMSE) root Mean Square Error: The root mean squared error, which is the square root of the average squared distance (difference
between the actual and expected value), is another often used statistic. The square root of each square of the distance divided by the
total number of points is the definition of RMSE.
(MSE) mean_squared_error: This is a metric that measures the average squared difference between the predicted and actual values.
It is calculated as the mean of the squared differences between the predicted and actual values. This metric is useful for penalizing
large errors in the predictions, and is commonly used as a loss function during training. However, it can be sensitive to outliers and
does not provide an easily interpretable measure of error in the original units of the response variable.
(MAE) mean_absolute_error: This is a metric that measures the average absolute difference between the predicted and actual values.
It is calculated as the mean of the absolute differences between the predicted and actual values. This metric provides an easily
interpretable measure of error in the original units of the response variable, and is less sensitive to outliers than the mean squared
error.
r2_score: This is a metric that measures the proportion of variance in the target variable that is explained by the model, normalized
by the total variance in the target variable. It is calculated as 1 - (sum of squared residuals / total sum of squares). This metric
provides a normalized indication of how well the model fits the data, and can be interpreted as the percentage of variance in the
target variable that is explained by the model. It ranges from 0 to 1, with 1 indicating a perfect fit and values close to 0 indicating
poor performance.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4470
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com
VII. CONCLUSION
With the introduction of Deep Learning Technique and its strong algorithms, the most recent market research and equity Market
Price Prediction advancements have begun to include such approaches in analyzing equity market data. The Opening Value of the
Equity, the Highest and Lowest values of that equity on the same days, as well as the Closing Value at the end of the day, are all
indicated for each date. Predicting the equity market was a time-consuming and laborious procedure a few years or even a decade
ago. However, with the application of Deep learning using LSTM for equity market Price Prediction, forcaste, analysis and
diversification portfolio analysis, the procedure has become much simpler. Deep learning not only saves time and resources but also
outperforms people in terms of performance. It will always prefer to use a trained computer algorithm since it will advise you based
only on facts, numbers, and data and will not factor in emotions or prejudice
REFERENCES
[1] S. Selvin, R. Vinayakumar, E. A. Gopalkrishnan, V. K. Menon and K. P. Soman, "Stock price prediction using LSTM, RNN and CNN-sliding window model,"
in International Conference on Advances in Computing, Communications and Informatics, 2017.
[2] Stock Price Prediction Using LSTM on Indian Share Market by Achyut Ghosh, Soumik Bose1, Giridhar Maji, Narayan C. Debnath, Soumya Sen,2019. vol
63,pp 101—110
[3] Murtaza Roondiwala, Harshal Patel, Shraddha Varma, “Predicting Stock Prices Using LSTM” in Undergraduate Engineering Students, Department of
Information Technology, Mumbai University, 2015. Volume 6, Issue 4
[4] Xiongwen Pang, Yanqiang Zhou, Pan Wang, Weiwei Lin, “An innovative neural network approach for stock market prediction”, Springer Science+Business
Media, LLC, part of Springer Nature 2018
[5] Ishita Parmar, Navanshu Agarwal, Sheirsh Saxena, Ridam Arora, Shikhin Gupta, Himanshu Dhiman, Lokesh Chouhan Department of Computer Science and
Engineering National Institute of Technology, Hamirpur – 177005, INDIA - Stock Market Prediction Using Machine Learning.2018
[6] Pranav Bhat Electronics and Telecommunication Department, Maharashtra Institute of Technology, Pune. Savitribai Phule Pune University - A Machine
Learning Model for Stock Market Prediction,2020,JRECE VOL. 8 ISSUE 1
[7] Stock Market Prediction Using LSTM Recurrent Neural Network Adil MOGHAR ,Mhamed HAMICHE, Volume 170,2020
[8] Anurag Sinha Department of computer science, Student, Amity University Jharkhand Ranchi, Jharkhand (India), 834001 - Stock Market Prediction Using
Machine Learning,2022, Vol 13, Issue 06
[9] V Kranthi Sai Reddy Student, ECM, Sreenidhi Institute of Science and Technology, Hyderabad, India - Stock Market Prediction Using Machine
Learning.,2018, Volume: 05 Issue: 10
[10] S. Dinesh1, A.M.S. Rama Raju1, S. Rahul1, O. Naga Sandeep1 Mr. N D S S Kiran Relangi2 1Final year students of Department of CSE, Anil Neerukonda
Institute of Technology and Sciences,2021, Volume X, Issue VI
[11] Stock Market Prediction Using LSTM Technique Drashti Talati , Dr. Miral Patel , Prof. Bhargesh Patel, Volume 10 Issue VI,2022
[12] "STOCK MARKET PREDICTION USING LSTM NEURAL NETWORKS" P. Akhila, Dr.P.Krishna Subba Rao, CH.Avinash,2018,Vol.5, Issue 5
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4471