0% found this document useful (0 votes)
3 views

136 Artificial Intelligence Based Stock Market Prediction Model Using Technical Indicators

The document presents a model for predicting stock market trends using Artificial Intelligence and Stock Technical Indicators (STIs) such as LSTM and SVM. It emphasizes the effectiveness of technical analysis over fundamental analysis for stock indices, detailing various machine learning algorithms and their applications in stock price prediction. The study focuses on the National Stock Exchange of India and aims to enhance prediction accuracy through the integration of technical indicators into automated trading systems.

Uploaded by

Ivan Medić
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

136 Artificial Intelligence Based Stock Market Prediction Model Using Technical Indicators

The document presents a model for predicting stock market trends using Artificial Intelligence and Stock Technical Indicators (STIs) such as LSTM and SVM. It emphasizes the effectiveness of technical analysis over fundamental analysis for stock indices, detailing various machine learning algorithms and their applications in stock price prediction. The study focuses on the National Stock Exchange of India and aims to enhance prediction accuracy through the integration of technical indicators into automated trading systems.

Uploaded by

Ivan Medić
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

International Journal of Trend in Scientific Research and Development (IJTSRD)

Volume 7 Issue 2, March-April 2023 Available Online: www.ijtsrd.com e-ISSN: 2456 – 6470

Artificial Intelligence Based Stock Market


Prediction Model using Technical Indicators
Mr. Ketan Ashok Bagade1, Yogini Bagade2
1
Vidyalankar Polytechnic, Faculty of Information Technology, Mumbai, Maharashtra, India
2
Vidya Prasarak Mandal's Polytechnic, Faculty of Electrical Engineering, Mumbai, Maharashtra, India

ABSTRACT How to cite this paper: Mr. Ketan


The stock market is highly volatile and complex in nature. However, Ashok Bagade | Yogini Bagade
notion of stock price predictability is typical, many researchers "Artificial Intelligence Based Stock
suggest that the Buy & Sell prices are predictable and investor can Market Prediction Model using
make above-average profits using efficient Technical Analysis Technical Indicators" Published in
International Journal
(TA).Most of the earlier prediction models predict individual stocks
of Trend in
and the results are mostly influenced by company’s reputation, news, Scientific Research
sentiments and other fundamental issues while stock indices are less and Development
affected by these issues. In this work, an effort is made to predict the (ijtsrd), ISSN: 2456-
Buy & Sell decisions of stocks, trends of stock by utilizing Stock 6470, Volume-7 |
Technical Indicators (STIs) As a part of prediction model the Long Issue-2, April 2023, IJTSRD53854
Short-Term Memory (LSTM), Support Virtual Machine (SVM) pp.1026-1033, URL:
Artificial intelligence algorithms will be used with (Stock Technical www.ijtsrd.com/papers/ijtsrd53854.pdf
Indicators) STIs. The project will be carried on National Stock
Exchange (NSE) Stocks of India. Copyright © 2023 by author (s) and
International Journal of Trend in
KEYWORDS: Stock Technical Indicators (STIs), Long Short-Term Scientific Research and Development
memory (LSTM), Support Vector Machine (SVM), Moving Averages Journal. This is an
(MA), Exponential Moving Average (EMA), Moving Average Open Access article
distributed under the
Convergence Divergence (MACD), Relative Strength Index (RSI),
terms of the Creative Commons
Stochastic Oscillator (SO), William %R(WPR), Rate of Change Attribution License (CC BY 4.0)
(ROC), Commodity Channel Index (CCI), Momentum (MOM) (http://creativecommons.org/licenses/by/4.0)

1. INTRODUCTION
The analysis and prediction of stock market data have DMI (ADX), William (WPR), Rate of Change
got a significant role in today’s economy. The (ROC), Commodity Channel Index (CCI),
prediction models are based on various algorithms and Momentum
can be categorized into linear models such as Auto-
(MOM) for Stock Market Prediction.
Regressive Integrated Moving Average (ARIMA) and
Hybrid Method: Utilizes combination of both of
non-linear models like Machine learning, Neural
the above methods.
Network (NN) and Deep Learning.
Time series analysis: Utilizes analysis of time
Numerous researchers have attempted to construct an series data.
efficient model for prediction of Stock market for the
The stock indices are generally not affected by
individual stocks and indices.
fundamental issues, so technical analysis is a better
The approaches, for stock price prediction, are option for indices prediction. STIs are statistical
generally classified into four categories calculations based on the price, volume or significance
Fundamental Analysis(FA): Utilizes news, for a share, security or contract.
earnings, profits and other economic factors for
STIs are independent of fundamentals of a business,
forecasting.
like earnings, revenue, or profit margins. The TA is
Technical Analysis (TA) : Utilizes technical
useful while predicting the future prices of assets so it
indicators like Moving Averages (MA),
can also be integrated into automated trading systems.
Exponential Moving Average (EMA), Moving
The TA anticipates what is likely to happen to prices
Average Convergence Divergence (MACD),
over time, while the Artificial intelligence give
Relative Strength Index (RSI), Stochastic
strength to such anticipations by improving accuracy.
Oscillator (SO), Average Directional Index with

@ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1026
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470
2. Literature Review: Dongdong Lv[4], analysed large-scale stock datasets.
STIs are statistical calculations based on the price, He synthetically evaluate various ML algorithms and
volume, or significance for a share, security or observe the daily trading performance of stocks under
contract. These does not depend on fundamentals of a transaction cost and no transaction cost. Particularly,
business, like earnings, revenue, or profit margins. he used two large datasets of 424 S&P 500 index
The active stock traders and technical analysts component stocks (SPICS) and 185 CSI 300 index
commonly use STI’s to analyze short-term and long- component stocks (CSICS) from 2010 to 2017 and
term price movements and to identify entry and exit compare six traditional ML algorithms and six
points. Technical indicators can be useful while advanced deep neural network (DNN) models on
predicting the Buy & Sell decisions of stocks, trends these two datasets, respectively. According to this
of stock. paper ML algorithm has better performance for
technical indicators.
M. Nabipour [1] Collected 10 years historical data of
stocks. The value predictions are created for 1, 2, 5, Hyun Sik Sim[5] propose a stock price prediction
10, 15, 20, and 30 days in advance. Various machine model based on convolutional neural network (CNN)
learning algorithms were utilized for prediction of to validate the applicability of new learning methods
future values of stock market groups. He employed in stock markets. When applying CNN, technical
decision tree, bagging, random forest, adaptive indicators were chosen as predictors of the forecasting
boosting (Adaboost), gradient boosting, and eXtreme model, and the technical indicators were converted to
gradient boosting (XGBoost), and artificial neural images of the time series graph. This study addresses
networks (ANN), recurrent neural network (RNN) and two critical issues regarding the use of CNN for stock
long short-term memory (LSTM). Technical price prediction: how to use CNN and how to
indicators were selected as the inputs into each of the optimize them.
prediction models. The results of the predictions were Mojtaba Nabipour[6] study compares nine machine
presented for each technique based on four metrics. learning models (Decision Tree, Random Forest,
Among all algorithms used in this paper, LSTM Adaptive Boosting (Adaboost), eXtreme Gradient
shows more accurate results with the highest model Boosting (XGBoost), Support Vector Classifier
fitting ability. (SVC), Naïve Bayes, K-Nearest Neighbors (KNN),
Can Yang [2] presents a deep learning framework to Logistic Regression and Artificial Neural Network
predict price movement direction based on historical (ANN)) and two powerful deep learning methods
information in financial time series. The framework (Recurrent Neural Network (RNN) and Long short-
combines a convolutional neural network (CNN) for term memory (LSTM). Technical indicators from ten
feature extraction and a long short-term memory years of historical data are our input values, and two
(LSTM) network for prediction. He specifically use a ways are supposed for employing them. Firstly,
three-dimensional CNN for data input in the calculating the indicators by stock trading values as
framework, including the information on time series, continues data, and secondly converting indicators to
technical indicators, and the correlation between stock binary data before using. Each prediction model is
indices. And in the three-dimensional input tensor, the evaluated by three metrics based on the input ways.
technical indicators are converted into deterministic The evaluation results indicate that for the continues
trend signals and the stock indices are ranked by data, RNN and LSTM outperform other prediction
Pearson product-moment correlation coefficient models with a considerable difference. Also, results
(PPMCC). When training, a fully connected network show that in the binary data evaluation, those deep
is used to drive the CNN to learn a feature vector, learning methods are the best. however, the difference
which acts as the input of concatenated LSTM. After becomes less because of the noticeable improvement
both the CNN and the LSTM are trained well, they are of models’ performance in the second way.
finally used for prediction in the testing set.
3. Stock Technical Indicators
Manish Agrawal [3] effort is made to predict the STIs are statistical calculations based on the price,
prices of stock indices by utilizing Stock Technical volume, or significance for a share, security or
Indicators (STIs) which in turn helps to take buy-sell contract. These does not depends on fundamentals of
decision over long and short term. Two different a business, like earnings, revenue, or profit margins.
models are built, one for future price trend prediction The active stock traders and technical analysts
of indices and other for taking Buy-Sell decision at the commonly use STIs to analyze short-term and long
end of day. As a part of prediction model the term price movements and to identify entry and exit
optimized Long Short Term Memory (LSTM) model points. Technical indicators can be useful while
is combined with highly correlated STIs. predicting the future prices of assets so they can be

@ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1027
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470
integrated into automated trading systems. There are and helps to smooth out price. It is said as trend
two basic types of technical indicators: Overlays and following indicator or simply lagging as it depends on
Oscillators. In this work, we use SMA as it is one past prices. Formulae for calculating the most
among the most widely used STI. It filters out the prevailing Stock Technical Indicators (STIs) is
noise which occurs due to random price variations presented in Table 1.

Stock Technical Indicators (STIs) Mathematical Formula


Moving Averages (MA)

Exponential Moving Average (EMA)

Moving Average Convergence Divergence (MACD) 13 Period EMA – 26 Period EMA

Relative Strength Index (RSI)

Stochastic Oscillator (%K)(SO)

William %R(WPR)

Rate of Change (ROC)

Commodity Channel Index(CCI)

Momentum(MOM) Momentum = C- Cx
Table 1: Stock Technical Indicators
Details of Technical Indicators
Moving Average (MA)
Moving Average (MA) are average values for a given
time frame and they reflect mood of market. It’s a
simple average of the past closing.eg., 50 day SMA is Where Smoothing = 2
nothing but average of previous 50 days closing
prices. Moving Average Convergence Divergence
(MACD)
Formula for Moving Average is Moving Average Convergence Divergence (MACD)
is a trading indicator used in technical analysis.It is
called as Trend indicator. MACD indicator has 3
components in it. MACD Line is blue line in the
Cn = Closing price of an stock at period n. MACD indicators. It is calculation result of
n = The number of total periods. subtracting 26-period EMA from 12-Period
EMA.Signal Line is the Red line which is plotted on
Exponential Moving Average (EMA)
the top of the MACD line. It is basically 9-Period
Exponential Moving Average (EMA) is a type of
EMA of the MACD lineWhen MACD line crosses
moving average that is similar to a simple moving
the signal line in upward direction it triggers a Buy
average, except that more weight is given to the latest
signal When MACD line crossing the signal line in
data. The exponential moving average is also known
downward direction triggers a SELL Signal.
as exponentially weighted moving average. EMA is
Histogram are vertical lines/bars.
used to produce buy and sell signals based on
crossovers. Important EMA are 5,13,26,50,100,200 Formula for Moving Average Convergence
Divergence is
Formula for Exponential Moving Average is
12 Period EMA − 26 Period EMA

@ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1028
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470
Relative Strength Index (RSI) William % Range (WPR)
Relative Strength Index (RSI) is a popular momentum Williams %R (WPR) moves between zero and -100. A
oscillator. The RSI provides technical traders signals reading above -20 is overbought. A reading below -80
about bullish and bearish price momentum, and it is is oversold. An overbought or oversold reading
often plotted beneath the graph of an asset's price. An doesn't mean the price will reverse. Overbought
stock is usually considered overbought when the RSI simply means the price is near the highs of its recent
is above 70% and oversold when it is below 30% range. Oversold means the price is in the lower end of
its recent range. Can be used to generate trade signals
Formula for Relative Strength Index is
when the price and the indicator move out of
overbought or oversold territory.
Formula for Moving Average is
Stochastic Oscillator(SO)
Stochastic Oscillator (SO) is a popular technical
indicator for generating overbought and oversold where:
signals. Readings over 80 are considered in the Highest High=Highest price in the lookback
overbought range, and readings under 20 are period, typically 14 days.
considered oversold. It is a popular momentum Close=Most recent closing price.
indicator. %K is referred to sometimes as the fast Lowest Low=Lowest price in the lookback
stochastic indicator.(Blue wave). The slow stochastic period, typically 14 days.
indicator is taken as %D = 3-period moving average
Rate of Change(ROC)
of %K. (Red Wave) Rate of Change (ROC) Measures the percentage
Formula for Relative Strength Index is change between the most recent price and the price
“n” Periods in the past. ROC is classed as a price
momentum oscillator or a velocity Indicator because it
measures the rate of change or the strength of
where:
momentum of change. It is set against a zero-level
C = The most recent closing price
midpoint. A rising ROC above zero typically confirms
L14 = The lowest price traded of the 14 previous
an uptrend while a falling ROC below zero indicates a
trading sessions.
downtrend. When the price is consolidating, the ROC
H14 = The highest price traded during the same14
will hover near zero.
day period
%K = The current value of the stochastic indicator Formula for Rate of Change is
%D = 3-period moving average of %K.
Avg.Directional Index with DMI(ADX)
Directional Movement Index (DMI) is made of “+DI”, where:
“-DI” and ADX where +DI and –DI are directional B=price at current time
Indicators & ADX is a strength in a given trend. A=price at previous time
If +DI > -DI - Bullish direction. ADX shows strength
Commodity Change Index(CCI)
in uptrend.
Commodity Change Index (CCI) is a market indicator
If -DI > +DI - Bearish direction. ADX shows strength used to track market movements that may indicate
in downtrend. buying or selling. The CCI compares current price to
ADX should be > 12 average price over a specific time period. The
Formula for Avg.Directional Index with DMI is indicator fluctuates above or below zero, moving into
positive or negative territory. When the CCI moves
above +100, a new, strong uptrend is beginning,
signaling a buy. When the CCI moves below −100, a
new, strong downtrend is beginning, signaling a
sell. Look for overbought levels above +100 and
oversold levels below -100.
Formula for Commodity Change Index is

@ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1029
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470
Where term value of the stock is relatively easy than
predicting on day-to-day basis as the stocks fluctuate
rapidly every hour based on world events.
4.1. Problem Definition
The objective of our project is to develop a Artificial
Intelligence System Using Technical indicators to
predict Stock trends. There are various technical
Momentum(MOM) indicators like Moving Averages (MA), Exponential
Momentum (MOM) is the speed or velocity of price Moving Average(EMA), Moving Average
changes in a stock, security, or tradable instrument. Convergence Divergence (MACD), Relative Strength
Momentum shows the rate of change in price Index (RSI),Stochastic Oscillator, ADX –
movement over a period of time to help investors Avg.Directional Index with DMI, William %R
determine the strength of a trend. Investors use (WPR), Rate of Change(ROC), Commodity Channel
momentum to trade stocks whereby a stock can Index(CCI), Momentum(MOM) are calculated on
exhibit bullish momentum–the price is rising–or basis of closing price, opening price, High price, low
bearish momentum–the price is falling. price.
For UpTrend We will use this technical indicators as input to our AI
MOM > 0 = Upward Bias algorithms i.e., support vector machine (SVM) &
MOM > 0 + Price Increase = Strong UpTrend Long Short Term Memory(LSTM).Our AI algorithms
MOM > 0 + Price Decrease = Weak UpTrend will give accuracy, buy & sell decisions, trends of the
For DownTrend Stock. On this basis trader can take decision of buying
MOM < 0 = Downward Bias and selling of stock.
MOM < 0 + Price Decrease = Strong DownTrend 4.2. Objectives
MOM < 0 + Price Increase = Weak DownTrend The system must be able to access a list of
Formula for Momentum is historical prices. It must calculate the STI based
Momentum = C- Cx on the historical data. It must also provide an
instantaneous visualization of the market index.
where: As a consequence, an automated system or model,
C =Latest price to analyses the stock market and upcoming stock
Cx =closing price trends based on historical prices and STIs, is
x=Number of days ago needed.
4. Problem Statement Two versions of prediction system will be
The investors usually take the decisions of buying or implemented; one using Support Vector Machines
selling the stock by evaluating a company’s and other using Long Short Term Memory
performance and other unexpected global, national & (LSTM). The experimental objective will be to
social events. Although, such events eventually affect compare the forecasting ability of SVM with
stock prices instantaneously in a negative or positive LSTM. We will test and evaluate both the systems
way, these effects are not permanent most of the time. with same test data to find their prediction
So, it is not viable to predict the stock prices and accuracy.
trends on the basis of Fundamental Analysis.
Applying traditional machine learning and deep
Investors are familiar with the saying, “buy low, sell learning approaches yields average results as the
high” but this does not provide enough context to stock market follows random walk motion.
make proper investment decisions. Before an investor Applying AI Learning algorithm and adaptive
invests in any stock, he needs to be aware how the STIs can make an effective forecast.
stock market behaves. Investing in a good stock but at
a bad time can have disastrous results, while 4.3. Suggested System Architecture
investment in a mediocre stock at the right time can we are proposing new model for the Stock Market
bear profits. Financial investors of today are facing Prediction. Proposed system consists of different
this problem of trading as they do not properly modules working together to achieve robust and more
understand as to which stocks to buy or which stocks accurate system than its predecessors.
to sell in order to get optimum profits. Predicting long

@ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1030
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470

Fig.1 System Architecture of Stock Price Prediction


The stock data is captured through APIs. The values of Stock i.e., Date, Time, stock-name, Volume, Open, High,
Low and Close (OHLC) prices are extracted from the dataset. We will build the new input features, which are
known as STIs, by applying technical analysis. The STI will be given to AI algorithms LSTM,SVM. This AI
algorithm will give the output i.e., predicted Buy & sell decision, Identifies up-trend & down-trend, comparison
between SVM & LSTM output.
4.4. Block Diagram of the System.
Input to the system are date, symbol, close price, open price, high price, low price, previous close price.
SMA,EMA,MACD,RSI,SO,ADX,WPR,ROC,CCI,MOM are Stock Technical Indicators(STI’s) values are
calculated from input values.

Fig.2 Block Diagram of the System


Calculated STI values are send to Prediction Model of LSTM (Long Short Term Memory), SVM(Support Vector
Machine).
Output from Prediction model will be BUY/SELL Signals.

@ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1031
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470
4.5. Flowchart:

Fig.4 Support Vector Machine


Support Vectors are simply the co-ordinates of
individual observation. The SVM classifier is a
frontier which best segregates the two classes (hyper-
plane/ line).
5.2. Long Short Term Memory(LSTM)
LSTM (Long short-term Memory) is a type of RNN
(Recurrent neural network), which is a famous deep
learning algorithm that is well suited for making
predictions and classification with a flavour of the
Fig.3 Flowchart of Stock Market Prediction
time. Unlike standard feed-forward neural networks,
System
LSTM has feedback connections.
4.6. System Requirements:
Hardware Software
Processor:
Operating System:Windows10
Pentium-i5
RAM: 4GB (min) Anaconda Navigator
Hard disk: 20GB Jupyter Notebook
Python Programming.AI
Monitor: VGA Algorithm & Libraries,
Python Libraries.
5. Artificial Intelligence ALGORITHM
Support Vector Machine (SVM) and Long Short Term Fig.5 Long short-term Memory(LSTM) Cell
Memory (LSTM) will be used for prediction. SVM is A general LSTM unit is composed of a cell, an input
a supervised machine learning algorithm and LSTM is gate, an output gate, and a forget gate. The cell
a deep learning algorithm. remembers values over arbitrary time intervals, and
5.1. Support vector machine(svm) three gates regulate the flow of information into and
Support Vector Machine (SVM) is a supervised out of the cell. LSTM is well-suited to classify,
machine learning algorithm which can be used for process, and predict the time series given of unknown
both classification or regression challenges. However, duration.
it is mostly used in classification problems. In the Conclusion
SVM algorithm, we plot each data item as a point in We studied the existing Stock Prediction System. To
n-dimensional space (where n is number of features predict and present Stock Prediction System we will
you have) with the value of each feature being the use Long Short Term Memory (LSTM), Support
value of a particular coordinate. Then, we perform Virtual Machine(SVM) AI models. The models
classification by finding the hyper-plane that proposed in this Work will helps us to decide the stock
differentiates the two classes very well. trends as well as decision of selling or buying the
stock. The proposed models thus decreasing the risk
while increasing there returns on investments.

@ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1032
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470
References [4] Dongdong Lv, Shuhan Yuan, Meizi Li and
[1] M. Nabipour, P. Nayyeri, H. Jabani, A. Mosavi, Yang Xiang “An Empirical Study of Machine
E. Salwana and Shahab S. “Deep Learning for Learning Algorithms for Stock Daily Trading
Stock Market Prediction” Published in National Strategy” Published in Hindawi Publication
Center for Biotechnology Information Volume Volume 2019, Article ID 7816154
22(8) 2020 Aug
[5] Hyun Sik Sim, Hae In Kim,and Jae Joon Ahn
[2] Can Yang, Junjie Zhai, and Guihua Tao “Deep “Is Deep Learning for Image Recognition
Learning for Price Movement Prediction Using Applicable to Stock Market Prediction”
Convolutional Neural Network and Long Short- Published in Hindawi Publication Volume 2019,
Term Memory” Published in Hindawi Article ID 4324878
Publication Volume 2020, Article ID 274 [6] Mojtaba Nabipour, Pooyan Nayyeri, Hamed
[3] Manish Agrawal, Asif Ullah Khan and Piyush Jabani, Shahab S., Amir Mosavi “Predicting
Kumar Shukla “Stock Indices Price Prediction stock market trends using machine learning and
Based on Technical Indicators using Deep deep learning algorithms via continuous and
Learning Model” published in International binary data; a comparative analysis on the
Journal on Emerging Technologies Volume Tehran stock exchange” Published in IEEE
10(2) 2019. Volume 8 2017

@ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1033

You might also like