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 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1026 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 The stock market is highly volatile and complex in nature. However, notion of stock price predictability is typical, many researchers suggest that the Buy & Sell prices are predictable and investor can make above-average profits using efficient Technical Analysis (TA).Most of the earlier prediction models predict individual stocks and the results are mostly influenced by company’s reputation, news, sentiments and other fundamental issues while stock indices are less affected by these issues. In this work, an effort is made to predict the Buy & Sell decisions of stocks, trends of stock by utilizing Stock Technical Indicators (STIs) As a part of prediction model the Long Short-Term Memory (LSTM), Support Virtual Machine (SVM) Artificial intelligence algorithms will be used with (Stock Technical Indicators) STIs. The project will be carried on National Stock Exchange (NSE) Stocks of India. KEYWORDS: Stock Technical Indicators (STIs), Long Short-Term memory (LSTM), Support Vector Machine (SVM), Moving Averages (MA), Exponential Moving Average (EMA), Moving Average Convergence Divergence (MACD), Relative Strength Index (RSI), Stochastic Oscillator (SO), William %R(WPR), Rate of Change (ROC), Commodity Channel Index (CCI), Momentum (MOM) How to cite this paper: Mr. Ketan Ashok Bagade | Yogini Bagade "Artificial Intelligence Based Stock Market Prediction Model using Technical Indicators" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456- 6470, Volume-7 | Issue-2, April 2023, pp.1026-1033, URL: www.ijtsrd.com/papers/ijtsrd53854.pdf Copyright © 2023 by author (s) and International Journal of Trend in Scientific Research and Development Journal. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (CC BY 4.0) (http://creativecommons.org/licenses/by/4.0) 1. INTRODUCTION The analysis and prediction of stock market data have got a significant role in today’s economy. The prediction models are based on various algorithms and can be categorized into linear models such as Auto- Regressive Integrated Moving Average (ARIMA) and non-linear models like Machine learning, Neural Network (NN) and Deep Learning. Numerous researchers have attempted to construct an efficient model for prediction of Stock market for the individual stocks and indices. The approaches, for stock price prediction, are generally classified into four categories Fundamental Analysis(FA): Utilizes news, earnings, profits and other economic factors for forecasting. Technical Analysis (TA) : Utilizes technical indicators like Moving Averages (MA), Exponential Moving Average (EMA), Moving Average Convergence Divergence (MACD), Relative Strength Index (RSI), Stochastic Oscillator (SO), Average Directional Index with DMI (ADX), William (WPR), Rate of Change (ROC), Commodity Channel Index (CCI), Momentum (MOM) for Stock Market Prediction. Hybrid Method: Utilizes combination of both of the above methods. Time series analysis: Utilizes analysis of time series data. The stock indices are generally not affected by fundamental issues, so technical analysis is a better option for indices prediction. STIs are statistical calculations based on the price, volume or significance for a share, security or contract. STIs are independent of fundamentals of a business, like earnings, revenue, or profit margins. The TA is useful while predicting the future prices of assets so it can also be integrated into automated trading systems. The TA anticipates what is likely to happen to prices over time, while the Artificial intelligence give strength to such anticipations by improving accuracy. IJTSRD53854
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1027 2. Literature Review: STIs are statistical calculations based on the price, volume, or significance for a share, security or contract. These does not depend on fundamentals of a business, like earnings, revenue, or profit margins. The active stock traders and technical analysts commonly use STI’s to analyze short-term and long- term price movements and to identify entry and exit points. Technical indicators can be useful while predicting the Buy & Sell decisions of stocks, trends of stock. M. Nabipour [1] Collected 10 years historical data of stocks. The value predictions are created for 1, 2, 5, 10, 15, 20, and 30 days in advance. Various machine learning algorithms were utilized for prediction of future values of stock market groups. He employed decision tree, bagging, random forest, adaptive boosting (Adaboost), gradient boosting, and eXtreme gradient boosting (XGBoost), and artificial neural networks (ANN), recurrent neural network (RNN) and long short-term memory (LSTM). Technical indicators were selected as the inputs into each of the prediction models. The results of the predictions were presented for each technique based on four metrics. Among all algorithms used in this paper, LSTM shows more accurate results with the highest model fitting ability. Can Yang [2] presents a deep learning framework to predict price movement direction based on historical information in financial time series. The framework combines a convolutional neural network (CNN) for feature extraction and a long short-term memory (LSTM) network for prediction. He specifically use a three-dimensional CNN for data input in the framework, including the information on time series, technical indicators, and the correlation between stock indices. And in the three-dimensional input tensor, the technical indicators are converted into deterministic trend signals and the stock indices are ranked by Pearson product-moment correlation coefficient (PPMCC). When training, a fully connected network is used to drive the CNN to learn a feature vector, which acts as the input of concatenated LSTM. After both the CNN and the LSTM are trained well, they are finally used for prediction in the testing set. Manish Agrawal [3] effort is made to predict the prices of stock indices by utilizing Stock Technical Indicators (STIs) which in turn helps to take buy-sell decision over long and short term. Two different models are built, one for future price trend prediction of indices and other for taking Buy-Sell decision at the end of day. As a part of prediction model the optimized Long Short Term Memory (LSTM) model is combined with highly correlated STIs. Dongdong Lv[4], analysed large-scale stock datasets. He synthetically evaluate various ML algorithms and observe the daily trading performance of stocks under transaction cost and no transaction cost. Particularly, he used two large datasets of 424 S&P 500 index component stocks (SPICS) and 185 CSI 300 index component stocks (CSICS) from 2010 to 2017 and compare six traditional ML algorithms and six advanced deep neural network (DNN) models on these two datasets, respectively. According to this paper ML algorithm has better performance for technical indicators. Hyun Sik Sim[5] propose a stock price prediction model based on convolutional neural network (CNN) to validate the applicability of new learning methods in stock markets. When applying CNN, technical indicators were chosen as predictors of the forecasting model, and the technical indicators were converted to images of the time series graph. This study addresses two critical issues regarding the use of CNN for stock price prediction: how to use CNN and how to optimize them. Mojtaba Nabipour[6] study compares nine machine learning models (Decision Tree, Random Forest, Adaptive Boosting (Adaboost), eXtreme Gradient Boosting (XGBoost), Support Vector Classifier (SVC), Naïve Bayes, K-Nearest Neighbors (KNN), Logistic Regression and Artificial Neural Network (ANN)) and two powerful deep learning methods (Recurrent Neural Network (RNN) and Long short- term memory (LSTM). Technical indicators from ten years of historical data are our input values, and two ways are supposed for employing them. Firstly, calculating the indicators by stock trading values as continues data, and secondly converting indicators to binary data before using. Each prediction model is evaluated by three metrics based on the input ways. The evaluation results indicate that for the continues data, RNN and LSTM outperform other prediction models with a considerable difference. Also, results show that in the binary data evaluation, those deep learning methods are the best. however, the difference becomes less because of the noticeable improvement of models’ performance in the second way. 3. Stock Technical Indicators STIs are statistical calculations based on the price, volume, or significance for a share, security or contract. These does not depends on fundamentals of a business, like earnings, revenue, or profit margins. The active stock traders and technical analysts commonly use STIs to analyze short-term and long term price movements and to identify entry and exit points. Technical indicators can be useful while predicting the future prices of assets so they can be
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1028 integrated into automated trading systems. There are two basic types of technical indicators: Overlays and Oscillators. In this work, we use SMA as it is one among the most widely used STI. It filters out the noise which occurs due to random price variations and helps to smooth out price. It is said as trend following indicator or simplylagging as it depends on past prices. Formulae for calculating the most prevailing Stock Technical Indicators (STIs) is 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 nothing but average of previous 50 days closing prices. Formula for Moving Average is Cn = Closing price of an stock at period n. n = The number of total periods. Exponential Moving Average (EMA) Exponential Moving Average (EMA) is a type of moving average that is similar to a simple moving average, except that more weight is given to the latest data. The exponential moving average is also known as exponentially weighted moving average. EMA is used to produce buy and sell signals based on crossovers. Important EMA are 5,13,26,50,100,200 Formula for Exponential Moving Average is Where Smoothing = 2 Moving Average Convergence Divergence (MACD) 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 MACD indicators. It is calculation result of subtracting 26-period EMA from 12-Period EMA.Signal Line is the Red line which is plotted on the top of the MACD line. It is basically 9-Period EMA of the MACD lineWhen MACD line crosses the signal line in upward direction it triggers a Buy signal When MACD line crossing the signal line in downward direction triggers a SELL Signal. Histogram are vertical lines/bars. Formula for Moving Average Convergence Divergence is 12 Period EMA − 26 Period EMA
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1029 Relative Strength Index (RSI) Relative Strength Index (RSI) is a popular momentum oscillator. The RSI provides technical traders signals about bullish and bearish price momentum, and it is often plotted beneath the graph of an asset's price. An stock is usually considered overbought when the RSI is above 70% and oversold when it is below 30% Formula for Relative Strength Index is Stochastic Oscillator(SO) Stochastic Oscillator (SO) is a popular technical indicator for generating overbought and oversold signals. Readings over 80 are considered in the overbought range, and readings under 20 are considered oversold. It is a popular momentum indicator. %K is referred to sometimes as the fast stochastic indicator.(Blue wave). The slow stochastic indicator is taken as %D = 3-period moving average of %K. (Red Wave) Formula for Relative Strength Index is where: C = The most recent closing price L14 = The lowest price traded of the 14 previous trading sessions. H14 = The highest price traded during the same14 day period %K = The current value of the stochastic indicator %D = 3-period moving average of %K. Avg.Directional Index with DMI(ADX) Directional Movement Index (DMI) is made of “+DI”, “-DI” and ADX where +DI and –DI are directional Indicators & ADX is a strength in a given trend. If +DI > -DI - Bullish direction. ADX shows strength in uptrend. If -DI > +DI - Bearish direction. ADX shows strength in downtrend. ADX should be > 12 Formula for Avg.Directional Index with DMI is William % Range (WPR) Williams %R (WPR) moves between zero and -100. A reading above -20 is overbought. A reading below -80 is oversold. An overbought or oversold reading doesn't mean the price will reverse. Overbought simply means the price is near the highs of its recent range. Oversold means the price is in the lower end of its recent range. Can be used to generate trade signals when the price and the indicator move out of overbought or oversold territory. Formula for Moving Average is where: Highest High=Highest price in the lookback period, typically 14 days. Close=Most recent closing price. Lowest Low=Lowest price in the lookback period, typically 14 days. Rate of Change(ROC) Rate of Change (ROC) Measures the percentage change between the most recent price and the price “n” Periods in the past. ROC is classed as a price momentum oscillator or a velocityIndicator because it measures the rate of change or the strength of momentum of change. It is set against a zero-level midpoint. A rising ROC above zero typicallyconfirms an uptrend while a falling ROC below zero indicates a downtrend. When the price is consolidating, the ROC will hover near zero. Formula for Rate of Change is where: B=price at current time A=price at previous time Commodity Change Index(CCI) Commodity Change Index (CCI) is a market indicator used to track market movements that may indicate buying or selling. The CCI compares current price to average price over a specific time period. The 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
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1030 Where Momentum(MOM) Momentum (MOM) is the speed or velocity of price changes in a stock, security, or tradable instrument. Momentum shows the rate of change in price movement over a period of time to help investors determine the strength of a trend. Investors use momentum to trade stocks whereby a stock can exhibit bullish momentum–the price is rising–or bearish momentum–the price is falling. For UpTrend MOM > 0 = Upward Bias MOM > 0 + Price Increase = Strong UpTrend MOM > 0 + Price Decrease = Weak UpTrend For DownTrend MOM < 0 = Downward Bias MOM < 0 + Price Decrease = Strong DownTrend MOM < 0 + Price Increase = Weak DownTrend Formula for Momentum is Momentum = C- Cx where: C =Latest price Cx =closing price x=Number of days ago 4. Problem Statement The investors usually take the decisions of buying or selling the stock by evaluating a company’s performance and other unexpected global, national & social events. Although, such events eventually affect stock prices instantaneously in a negative or positive way, these effects are not permanent most of the time. So, it is not viable to predict the stock prices and trends on the basis of Fundamental Analysis. Investors are familiar with the saying, “buy low, sell high” but this does not provide enough context to make proper investment decisions. Before an investor invests in any stock, he needs to be aware how the stock market behaves. Investing in a good stock but at a bad time can have disastrous results, while investment in a mediocre stock at the right time can bear profits. Financial investors of today are facing this problem of trading as they do not properly understand as to which stocks to buy or which stocks to sell in order to get optimum profits. Predicting long 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 indicators like Moving Averages (MA), Exponential Moving Average(EMA), Moving Average Convergence Divergence (MACD), Relative Strength Index (RSI),Stochastic Oscillator, ADX – Avg.Directional Index with DMI, William %R (WPR), Rate of Change(ROC), Commodity Channel Index(CCI), Momentum(MOM) are calculated on basis of closing price, opening price, High price, low price. We will use this technical indicators as input to our AI algorithms i.e., support vector machine (SVM) & Long Short Term Memory(LSTM).Our AIalgorithms will give accuracy, buy & sell decisions, trends of the Stock. On this basis trader can take decision of buying and selling of stock. 4.2. Objectives The system must be able to access a list of historical prices. It must calculate the STI based on the historical data. It must also provide an instantaneous visualization of the market index. As a consequence, an automated system or model, to analyses the stock market and upcoming stock trends based on historical prices and STIs, is needed. Two versions of prediction system will be implemented; one using Support Vector Machines and other using Long Short Term Memory (LSTM). The experimental objective will be to compare the forecasting ability of SVM with LSTM. We will test and evaluate both the systems with same test data to find their prediction accuracy. Applying traditional machine learning and deep learning approaches yields average results as the stock market follows random walk motion. Applying AI Learning algorithm and adaptive STIs can make an effective forecast. 4.3. Suggested System Architecture we are proposing new model for the Stock Market Prediction. Proposed system consists of different modules working together to achieve robust and more accurate system than its predecessors.
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1031 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.
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1032 4.5. Flowchart: Fig.3 Flowchart of Stock Market Prediction System 4.6. System Requirements: Hardware Software Processor: Pentium-i5 Operating System:Windows10 RAM: 4GB (min) Anaconda Navigator Hard disk: 20GB Jupyter Notebook Monitor: VGA Python Programming.AI Algorithm & Libraries, Python Libraries. 5. Artificial Intelligence ALGORITHM Support Vector Machine (SVM) and Long Short Term Memory (LSTM) will be used for prediction. SVM is a supervised machine learning algorithm and LSTM is a deep learning algorithm. 5.1. Support vector machine(svm) Support Vector Machine (SVM) is a supervised machine learning algorithm which can be used for both classification or regression challenges. However, it is mostly used in classification problems. In the SVM algorithm, we plot each data item as a point in n-dimensional space (where n is number of features you have) with the value of each feature being the value of a particular coordinate. Then, we perform classification by finding the hyper-plane that differentiates the two classes very well. 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-termMemory) 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 time. Unlike standard feed-forward neural networks, LSTM has feedback connections. Fig.5 Long short-term Memory(LSTM) Cell A general LSTM unit is composed of a cell, an input gate, an output gate, and a forget gate. The cell remembers values over arbitrary time intervals, and three gates regulate the flow of information into and out of the cell. LSTM is well-suited to classify, process, and predict the time series given of unknown duration. Conclusion We studied the existing Stock Prediction System. To predict and present Stock Prediction System we will use Long Short Term Memory (LSTM), Support Virtual Machine(SVM) AI models. The models proposed in this Work will helps us to decide the stock trends as well as decision of selling or buying the stock. The proposed models thus decreasing the risk while increasing there returns on investments.
International Journal of Trend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1033 References [1] M. Nabipour, P. Nayyeri, H. Jabani, A. Mosavi, E. Salwana and Shahab S. “Deep Learning for Stock Market Prediction” Published in National Center for Biotechnology Information Volume 22(8) 2020 Aug [2] Can Yang, Junjie Zhai, and Guihua Tao “Deep Learning for Price Movement Prediction Using Convolutional Neural Network and Long Short- Term Memory” Published in Hindawi Publication Volume 2020, Article ID 274 [3] Manish Agrawal, Asif Ullah Khan and Piyush Kumar Shukla “Stock Indices Price Prediction Based on Technical Indicators using Deep Learning Model” published in International Journal on Emerging Technologies Volume 10(2) 2019. [4] Dongdong Lv, Shuhan Yuan, Meizi Li and Yang Xiang “An Empirical Study of Machine Learning Algorithms for Stock Daily Trading Strategy” Published in Hindawi Publication Volume 2019, Article ID 7816154 [5] Hyun Sik Sim, Hae In Kim,and Jae Joon Ahn “Is Deep Learning for Image Recognition Applicable to Stock Market Prediction” Published in Hindawi Publication Volume2019, Article ID 4324878 [6] Mojtaba Nabipour, Pooyan Nayyeri, Hamed Jabani, Shahab S., Amir Mosavi “Predicting stock market trends using machine learning and deep learning algorithms via continuous and binary data; a comparative analysis on the Tehran stock exchange” Published in IEEE Volume 8 2017

Artificial Intelligence Based Stock Market Prediction Model using Technical Indicators

  • 1.
    International Journal ofTrend in Scientific Research and Development (IJTSRD) Volume 7 Issue 2, March-April 2023 Available Online: www.ijtsrd.com e-ISSN: 2456 – 6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1026 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 The stock market is highly volatile and complex in nature. However, notion of stock price predictability is typical, many researchers suggest that the Buy & Sell prices are predictable and investor can make above-average profits using efficient Technical Analysis (TA).Most of the earlier prediction models predict individual stocks and the results are mostly influenced by company’s reputation, news, sentiments and other fundamental issues while stock indices are less affected by these issues. In this work, an effort is made to predict the Buy & Sell decisions of stocks, trends of stock by utilizing Stock Technical Indicators (STIs) As a part of prediction model the Long Short-Term Memory (LSTM), Support Virtual Machine (SVM) Artificial intelligence algorithms will be used with (Stock Technical Indicators) STIs. The project will be carried on National Stock Exchange (NSE) Stocks of India. KEYWORDS: Stock Technical Indicators (STIs), Long Short-Term memory (LSTM), Support Vector Machine (SVM), Moving Averages (MA), Exponential Moving Average (EMA), Moving Average Convergence Divergence (MACD), Relative Strength Index (RSI), Stochastic Oscillator (SO), William %R(WPR), Rate of Change (ROC), Commodity Channel Index (CCI), Momentum (MOM) How to cite this paper: Mr. Ketan Ashok Bagade | Yogini Bagade "Artificial Intelligence Based Stock Market Prediction Model using Technical Indicators" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456- 6470, Volume-7 | Issue-2, April 2023, pp.1026-1033, URL: www.ijtsrd.com/papers/ijtsrd53854.pdf Copyright © 2023 by author (s) and International Journal of Trend in Scientific Research and Development Journal. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (CC BY 4.0) (http://creativecommons.org/licenses/by/4.0) 1. INTRODUCTION The analysis and prediction of stock market data have got a significant role in today’s economy. The prediction models are based on various algorithms and can be categorized into linear models such as Auto- Regressive Integrated Moving Average (ARIMA) and non-linear models like Machine learning, Neural Network (NN) and Deep Learning. Numerous researchers have attempted to construct an efficient model for prediction of Stock market for the individual stocks and indices. The approaches, for stock price prediction, are generally classified into four categories Fundamental Analysis(FA): Utilizes news, earnings, profits and other economic factors for forecasting. Technical Analysis (TA) : Utilizes technical indicators like Moving Averages (MA), Exponential Moving Average (EMA), Moving Average Convergence Divergence (MACD), Relative Strength Index (RSI), Stochastic Oscillator (SO), Average Directional Index with DMI (ADX), William (WPR), Rate of Change (ROC), Commodity Channel Index (CCI), Momentum (MOM) for Stock Market Prediction. Hybrid Method: Utilizes combination of both of the above methods. Time series analysis: Utilizes analysis of time series data. The stock indices are generally not affected by fundamental issues, so technical analysis is a better option for indices prediction. STIs are statistical calculations based on the price, volume or significance for a share, security or contract. STIs are independent of fundamentals of a business, like earnings, revenue, or profit margins. The TA is useful while predicting the future prices of assets so it can also be integrated into automated trading systems. The TA anticipates what is likely to happen to prices over time, while the Artificial intelligence give strength to such anticipations by improving accuracy. IJTSRD53854
  • 2.
    International Journal ofTrend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1027 2. Literature Review: STIs are statistical calculations based on the price, volume, or significance for a share, security or contract. These does not depend on fundamentals of a business, like earnings, revenue, or profit margins. The active stock traders and technical analysts commonly use STI’s to analyze short-term and long- term price movements and to identify entry and exit points. Technical indicators can be useful while predicting the Buy & Sell decisions of stocks, trends of stock. M. Nabipour [1] Collected 10 years historical data of stocks. The value predictions are created for 1, 2, 5, 10, 15, 20, and 30 days in advance. Various machine learning algorithms were utilized for prediction of future values of stock market groups. He employed decision tree, bagging, random forest, adaptive boosting (Adaboost), gradient boosting, and eXtreme gradient boosting (XGBoost), and artificial neural networks (ANN), recurrent neural network (RNN) and long short-term memory (LSTM). Technical indicators were selected as the inputs into each of the prediction models. The results of the predictions were presented for each technique based on four metrics. Among all algorithms used in this paper, LSTM shows more accurate results with the highest model fitting ability. Can Yang [2] presents a deep learning framework to predict price movement direction based on historical information in financial time series. The framework combines a convolutional neural network (CNN) for feature extraction and a long short-term memory (LSTM) network for prediction. He specifically use a three-dimensional CNN for data input in the framework, including the information on time series, technical indicators, and the correlation between stock indices. And in the three-dimensional input tensor, the technical indicators are converted into deterministic trend signals and the stock indices are ranked by Pearson product-moment correlation coefficient (PPMCC). When training, a fully connected network is used to drive the CNN to learn a feature vector, which acts as the input of concatenated LSTM. After both the CNN and the LSTM are trained well, they are finally used for prediction in the testing set. Manish Agrawal [3] effort is made to predict the prices of stock indices by utilizing Stock Technical Indicators (STIs) which in turn helps to take buy-sell decision over long and short term. Two different models are built, one for future price trend prediction of indices and other for taking Buy-Sell decision at the end of day. As a part of prediction model the optimized Long Short Term Memory (LSTM) model is combined with highly correlated STIs. Dongdong Lv[4], analysed large-scale stock datasets. He synthetically evaluate various ML algorithms and observe the daily trading performance of stocks under transaction cost and no transaction cost. Particularly, he used two large datasets of 424 S&P 500 index component stocks (SPICS) and 185 CSI 300 index component stocks (CSICS) from 2010 to 2017 and compare six traditional ML algorithms and six advanced deep neural network (DNN) models on these two datasets, respectively. According to this paper ML algorithm has better performance for technical indicators. Hyun Sik Sim[5] propose a stock price prediction model based on convolutional neural network (CNN) to validate the applicability of new learning methods in stock markets. When applying CNN, technical indicators were chosen as predictors of the forecasting model, and the technical indicators were converted to images of the time series graph. This study addresses two critical issues regarding the use of CNN for stock price prediction: how to use CNN and how to optimize them. Mojtaba Nabipour[6] study compares nine machine learning models (Decision Tree, Random Forest, Adaptive Boosting (Adaboost), eXtreme Gradient Boosting (XGBoost), Support Vector Classifier (SVC), Naïve Bayes, K-Nearest Neighbors (KNN), Logistic Regression and Artificial Neural Network (ANN)) and two powerful deep learning methods (Recurrent Neural Network (RNN) and Long short- term memory (LSTM). Technical indicators from ten years of historical data are our input values, and two ways are supposed for employing them. Firstly, calculating the indicators by stock trading values as continues data, and secondly converting indicators to binary data before using. Each prediction model is evaluated by three metrics based on the input ways. The evaluation results indicate that for the continues data, RNN and LSTM outperform other prediction models with a considerable difference. Also, results show that in the binary data evaluation, those deep learning methods are the best. however, the difference becomes less because of the noticeable improvement of models’ performance in the second way. 3. Stock Technical Indicators STIs are statistical calculations based on the price, volume, or significance for a share, security or contract. These does not depends on fundamentals of a business, like earnings, revenue, or profit margins. The active stock traders and technical analysts commonly use STIs to analyze short-term and long term price movements and to identify entry and exit points. Technical indicators can be useful while predicting the future prices of assets so they can be
  • 3.
    International Journal ofTrend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1028 integrated into automated trading systems. There are two basic types of technical indicators: Overlays and Oscillators. In this work, we use SMA as it is one among the most widely used STI. It filters out the noise which occurs due to random price variations and helps to smooth out price. It is said as trend following indicator or simplylagging as it depends on past prices. Formulae for calculating the most prevailing Stock Technical Indicators (STIs) is 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 nothing but average of previous 50 days closing prices. Formula for Moving Average is Cn = Closing price of an stock at period n. n = The number of total periods. Exponential Moving Average (EMA) Exponential Moving Average (EMA) is a type of moving average that is similar to a simple moving average, except that more weight is given to the latest data. The exponential moving average is also known as exponentially weighted moving average. EMA is used to produce buy and sell signals based on crossovers. Important EMA are 5,13,26,50,100,200 Formula for Exponential Moving Average is Where Smoothing = 2 Moving Average Convergence Divergence (MACD) 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 MACD indicators. It is calculation result of subtracting 26-period EMA from 12-Period EMA.Signal Line is the Red line which is plotted on the top of the MACD line. It is basically 9-Period EMA of the MACD lineWhen MACD line crosses the signal line in upward direction it triggers a Buy signal When MACD line crossing the signal line in downward direction triggers a SELL Signal. Histogram are vertical lines/bars. Formula for Moving Average Convergence Divergence is 12 Period EMA − 26 Period EMA
  • 4.
    International Journal ofTrend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1029 Relative Strength Index (RSI) Relative Strength Index (RSI) is a popular momentum oscillator. The RSI provides technical traders signals about bullish and bearish price momentum, and it is often plotted beneath the graph of an asset's price. An stock is usually considered overbought when the RSI is above 70% and oversold when it is below 30% Formula for Relative Strength Index is Stochastic Oscillator(SO) Stochastic Oscillator (SO) is a popular technical indicator for generating overbought and oversold signals. Readings over 80 are considered in the overbought range, and readings under 20 are considered oversold. It is a popular momentum indicator. %K is referred to sometimes as the fast stochastic indicator.(Blue wave). The slow stochastic indicator is taken as %D = 3-period moving average of %K. (Red Wave) Formula for Relative Strength Index is where: C = The most recent closing price L14 = The lowest price traded of the 14 previous trading sessions. H14 = The highest price traded during the same14 day period %K = The current value of the stochastic indicator %D = 3-period moving average of %K. Avg.Directional Index with DMI(ADX) Directional Movement Index (DMI) is made of “+DI”, “-DI” and ADX where +DI and –DI are directional Indicators & ADX is a strength in a given trend. If +DI > -DI - Bullish direction. ADX shows strength in uptrend. If -DI > +DI - Bearish direction. ADX shows strength in downtrend. ADX should be > 12 Formula for Avg.Directional Index with DMI is William % Range (WPR) Williams %R (WPR) moves between zero and -100. A reading above -20 is overbought. A reading below -80 is oversold. An overbought or oversold reading doesn't mean the price will reverse. Overbought simply means the price is near the highs of its recent range. Oversold means the price is in the lower end of its recent range. Can be used to generate trade signals when the price and the indicator move out of overbought or oversold territory. Formula for Moving Average is where: Highest High=Highest price in the lookback period, typically 14 days. Close=Most recent closing price. Lowest Low=Lowest price in the lookback period, typically 14 days. Rate of Change(ROC) Rate of Change (ROC) Measures the percentage change between the most recent price and the price “n” Periods in the past. ROC is classed as a price momentum oscillator or a velocityIndicator because it measures the rate of change or the strength of momentum of change. It is set against a zero-level midpoint. A rising ROC above zero typicallyconfirms an uptrend while a falling ROC below zero indicates a downtrend. When the price is consolidating, the ROC will hover near zero. Formula for Rate of Change is where: B=price at current time A=price at previous time Commodity Change Index(CCI) Commodity Change Index (CCI) is a market indicator used to track market movements that may indicate buying or selling. The CCI compares current price to average price over a specific time period. The 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
  • 5.
    International Journal ofTrend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1030 Where Momentum(MOM) Momentum (MOM) is the speed or velocity of price changes in a stock, security, or tradable instrument. Momentum shows the rate of change in price movement over a period of time to help investors determine the strength of a trend. Investors use momentum to trade stocks whereby a stock can exhibit bullish momentum–the price is rising–or bearish momentum–the price is falling. For UpTrend MOM > 0 = Upward Bias MOM > 0 + Price Increase = Strong UpTrend MOM > 0 + Price Decrease = Weak UpTrend For DownTrend MOM < 0 = Downward Bias MOM < 0 + Price Decrease = Strong DownTrend MOM < 0 + Price Increase = Weak DownTrend Formula for Momentum is Momentum = C- Cx where: C =Latest price Cx =closing price x=Number of days ago 4. Problem Statement The investors usually take the decisions of buying or selling the stock by evaluating a company’s performance and other unexpected global, national & social events. Although, such events eventually affect stock prices instantaneously in a negative or positive way, these effects are not permanent most of the time. So, it is not viable to predict the stock prices and trends on the basis of Fundamental Analysis. Investors are familiar with the saying, “buy low, sell high” but this does not provide enough context to make proper investment decisions. Before an investor invests in any stock, he needs to be aware how the stock market behaves. Investing in a good stock but at a bad time can have disastrous results, while investment in a mediocre stock at the right time can bear profits. Financial investors of today are facing this problem of trading as they do not properly understand as to which stocks to buy or which stocks to sell in order to get optimum profits. Predicting long 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 indicators like Moving Averages (MA), Exponential Moving Average(EMA), Moving Average Convergence Divergence (MACD), Relative Strength Index (RSI),Stochastic Oscillator, ADX – Avg.Directional Index with DMI, William %R (WPR), Rate of Change(ROC), Commodity Channel Index(CCI), Momentum(MOM) are calculated on basis of closing price, opening price, High price, low price. We will use this technical indicators as input to our AI algorithms i.e., support vector machine (SVM) & Long Short Term Memory(LSTM).Our AIalgorithms will give accuracy, buy & sell decisions, trends of the Stock. On this basis trader can take decision of buying and selling of stock. 4.2. Objectives The system must be able to access a list of historical prices. It must calculate the STI based on the historical data. It must also provide an instantaneous visualization of the market index. As a consequence, an automated system or model, to analyses the stock market and upcoming stock trends based on historical prices and STIs, is needed. Two versions of prediction system will be implemented; one using Support Vector Machines and other using Long Short Term Memory (LSTM). The experimental objective will be to compare the forecasting ability of SVM with LSTM. We will test and evaluate both the systems with same test data to find their prediction accuracy. Applying traditional machine learning and deep learning approaches yields average results as the stock market follows random walk motion. Applying AI Learning algorithm and adaptive STIs can make an effective forecast. 4.3. Suggested System Architecture we are proposing new model for the Stock Market Prediction. Proposed system consists of different modules working together to achieve robust and more accurate system than its predecessors.
  • 6.
    International Journal ofTrend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1031 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.
  • 7.
    International Journal ofTrend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1032 4.5. Flowchart: Fig.3 Flowchart of Stock Market Prediction System 4.6. System Requirements: Hardware Software Processor: Pentium-i5 Operating System:Windows10 RAM: 4GB (min) Anaconda Navigator Hard disk: 20GB Jupyter Notebook Monitor: VGA Python Programming.AI Algorithm & Libraries, Python Libraries. 5. Artificial Intelligence ALGORITHM Support Vector Machine (SVM) and Long Short Term Memory (LSTM) will be used for prediction. SVM is a supervised machine learning algorithm and LSTM is a deep learning algorithm. 5.1. Support vector machine(svm) Support Vector Machine (SVM) is a supervised machine learning algorithm which can be used for both classification or regression challenges. However, it is mostly used in classification problems. In the SVM algorithm, we plot each data item as a point in n-dimensional space (where n is number of features you have) with the value of each feature being the value of a particular coordinate. Then, we perform classification by finding the hyper-plane that differentiates the two classes very well. 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-termMemory) 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 time. Unlike standard feed-forward neural networks, LSTM has feedback connections. Fig.5 Long short-term Memory(LSTM) Cell A general LSTM unit is composed of a cell, an input gate, an output gate, and a forget gate. The cell remembers values over arbitrary time intervals, and three gates regulate the flow of information into and out of the cell. LSTM is well-suited to classify, process, and predict the time series given of unknown duration. Conclusion We studied the existing Stock Prediction System. To predict and present Stock Prediction System we will use Long Short Term Memory (LSTM), Support Virtual Machine(SVM) AI models. The models proposed in this Work will helps us to decide the stock trends as well as decision of selling or buying the stock. The proposed models thus decreasing the risk while increasing there returns on investments.
  • 8.
    International Journal ofTrend in Scientific Research and Development @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD53854 | Volume – 7 | Issue – 2 | March-April 2023 Page 1033 References [1] M. Nabipour, P. Nayyeri, H. Jabani, A. Mosavi, E. Salwana and Shahab S. “Deep Learning for Stock Market Prediction” Published in National Center for Biotechnology Information Volume 22(8) 2020 Aug [2] Can Yang, Junjie Zhai, and Guihua Tao “Deep Learning for Price Movement Prediction Using Convolutional Neural Network and Long Short- Term Memory” Published in Hindawi Publication Volume 2020, Article ID 274 [3] Manish Agrawal, Asif Ullah Khan and Piyush Kumar Shukla “Stock Indices Price Prediction Based on Technical Indicators using Deep Learning Model” published in International Journal on Emerging Technologies Volume 10(2) 2019. [4] Dongdong Lv, Shuhan Yuan, Meizi Li and Yang Xiang “An Empirical Study of Machine Learning Algorithms for Stock Daily Trading Strategy” Published in Hindawi Publication Volume 2019, Article ID 7816154 [5] Hyun Sik Sim, Hae In Kim,and Jae Joon Ahn “Is Deep Learning for Image Recognition Applicable to Stock Market Prediction” Published in Hindawi Publication Volume2019, Article ID 4324878 [6] Mojtaba Nabipour, Pooyan Nayyeri, Hamed Jabani, Shahab S., Amir Mosavi “Predicting stock market trends using machine learning and deep learning algorithms via continuous and binary data; a comparative analysis on the Tehran stock exchange” Published in IEEE Volume 8 2017