Stock Market Prediction using Artificial Neural Networks IME611 - Financial Engineering Indian Institute of Technology, Kanpur (208016), India

Similar documents
AN ARTIFICIAL NEURAL NETWORK MODELING APPROACH TO PREDICT CRUDE OIL FUTURE. By Dr. PRASANT SARANGI Director (Research) ICSI-CCGRT, Navi Mumbai

Barapatre Omprakash et.al; International Journal of Advance Research, Ideas and Innovations in Technology

Artificially Intelligent Forecasting of Stock Market Indexes

STOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING

Forecasting stock market prices

STOCK PRICE PREDICTION: KOHONEN VERSUS BACKPROPAGATION

STOCK MARKET TRENDS PREDICTION USING NEURAL NETWORK BASED HYBRID MODEL

The Use of Artificial Neural Network for Forecasting of FTSE Bursa Malaysia KLCI Stock Price Index

Genetic Algorithm Based Backpropagation Neural Network Performs better than Backpropagation Neural Network in Stock Rates Prediction

Design and Application of Artificial Neural Networks for Predicting the Values of Indexes on the Bulgarian Stock Market

Stock Market Forecasting Using Artificial Neural Networks

A Dynamic Hedging Strategy for Option Transaction Using Artificial Neural Networks

Forecasting of Stock Exchange Share Price using Feed Forward Artificial Neural Network

Keywords: artificial neural network, backpropagtion algorithm, derived parameter.

International Journal of Computer Engineering and Applications, Volume XII, Issue II, Feb. 18, ISSN

Bond Market Prediction using an Ensemble of Neural Networks

International Journal of Computer Engineering and Applications, Volume XII, Issue II, Feb. 18, ISSN

An enhanced artificial neural network for stock price predications

Valencia. Keywords: Conditional volatility, backpropagation neural network, GARCH in Mean MSC 2000: 91G10, 91G70

Cognitive Pattern Analysis Employing Neural Networks: Evidence from the Australian Capital Markets

Stock Trading Following Stock Price Index Movement Classification Using Machine Learning Techniques

COGNITIVE LEARNING OF INTELLIGENCE SYSTEMS USING NEURAL NETWORKS: EVIDENCE FROM THE AUSTRALIAN CAPITAL MARKETS

Performance analysis of Neural Network Algorithms on Stock Market Forecasting

Backpropagation and Recurrent Neural Networks in Financial Analysis of Multiple Stock Market Returns

Design and implementation of artificial neural network system for stock market prediction (A case study of first bank of Nigeria PLC Shares)

APPLICATION OF ARTIFICIAL NEURAL NETWORK SUPPORTING THE PROCESS OF PORTFOLIO MANAGEMENT IN TERMS OF TIME INVESTMENT ON THE WARSAW STOCK EXCHANGE

An Improved Approach for Business & Market Intelligence using Artificial Neural Network

Forecasting Foreign Exchange Rate during Crisis - A Neural Network Approach

Pattern Recognition by Neural Network Ensemble

Keywords Time series prediction, MSM30 prediction, Artificial Neural Networks, Single Layer Linear Counterpropagation network.

ANN Robot Energy Modeling

Iran s Stock Market Prediction By Neural Networks and GA

Stock Market Prediction System

COMPARING NEURAL NETWORK AND REGRESSION MODELS IN ASSET PRICING MODEL WITH HETEROGENEOUS BELIEFS

Keywords: artificial neural network, backpropagtion algorithm, capital asset pricing model

Stock Market Index Prediction Using Multilayer Perceptron and Long Short Term Memory Networks: A Case Study on BSE Sensex

Based on BP Neural Network Stock Prediction

Application of Innovations Feedback Neural Networks in the Prediction of Ups and Downs Value of Stock Market *

Journal of Internet Banking and Commerce

Forecasting Currency Exchange Rates via Feedforward Backpropagation Neural Network

Predicting Economic Recession using Data Mining Techniques

A Review of Artificial Neural Network Applications in Control. Chart Pattern Recognition

Dr. P. O. Asagba Computer Science Department, Faculty of Science, University of Port Harcourt, Port Harcourt, PMB 5323, Choba, Nigeria

International Journal of Research in Engineering Technology - Volume 2 Issue 5, July - August 2017

Applications of Neural Networks in Stock Market Prediction

SURVEY OF MACHINE LEARNING TECHNIQUES FOR STOCK MARKET ANALYSIS

Stock Market Prediction with Various Technical Indicators Using Neural Network Techniques

Foreign Exchange Rate Forecasting using Levenberg- Marquardt Learning Algorithm

$tock Forecasting using Machine Learning

Forecasting stock market return using ANFIS: the case of Tehran Stock Exchange

Predicting the stock price companies using artificial neural networks (ANN) method (Case Study: National Iranian Copper Industries Company)

2015, IJARCSSE All Rights Reserved Page 66

Stock Market Analysis Using Artificial Neural Network on Big Data

Statistical and Machine Learning Approach in Forex Prediction Based on Empirical Data

National Stock Exchange Stock and Index Price Direction Prediction using Backpropagation Artificial Neural Network

Prediction Using Back Propagation and k- Nearest Neighbor (k-nn) Algorithm

Saudi Arabia Stock Market Prediction Using Neural Network

Development and Performance Evaluation of Three Novel Prediction Models for Mutual Fund NAV Prediction

Using artificial neural networks for forecasting per share earnings

Stock market price index return forecasting using ANN. Gunter Senyurt, Abdulhamit Subasi

Evaluate the Ability of Artificial Neural Network to Predict the Stock Price of Non-Metallic Mineral Products Industry in Tehran's Stock Exchange

Long Term and Short Term Investment Strategy for Predicting the Performance of BSE using MLP Model

Application of Deep Learning to Algorithmic Trading

Predictive Model Learning of Stochastic Simulations. John Hegstrom, FSA, MAAA

Application of Artificial Neural Network For Path Loss Prediction In Urban Macrocellular Environment

Two kinds of neural networks, a feed forward multi layer Perceptron (MLP)[1,3] and an Elman recurrent network[5], are used to predict a company's

Outline. Neural Network Application For Predicting Stock Index Volatility Using High Frequency Data. Background. Introduction and Motivation

The Use of Neural Networks in the Prediction of the Stock Exchange of Thailand (SET) Index

An Intelligent Forex Monitoring System

Role of soft computing techniques in predicting stock market direction

STOCK MARKET FORECASTING USING NEURAL NETWORKS

A Comparative Study of Ensemble-based Forecasting Models for Stock Index Prediction

Stock Market Analysis Based on Artificial Neural Network with Big data

Neuro-Genetic System for DAX Index Prediction

Data based stock portfolio construction using Computational Intelligence

Two-Period-Ahead Forecasting For Investment Management In The Foreign Exchange

An Intelligent Approach for Option Pricing

Introducing GEMS a Novel Technique for Ensemble Creation

Spiking Back Propagation Multilayer Neural Network Design for Predicting Unpredictable Stock Market Prices with Time Series Analysis

Classification of Capital Expenditures and Revenue Expenditures: An Analysis of Correlation and Neural Networks

BULLETIN OF MATHEMATICS AND STATISTICS RESEARCH

OPENING RANGE BREAKOUT STOCK TRADING ALGORITHMIC MODEL

Application of synthetic observations to develop an artificial neural network for mine dewatering

Stock price development forecasting using neural networks

Abstract Making good predictions for stock prices is an important task for the financial industry. The way these predictions are carried out is often

Stock Market Prediction using Artificial Neural Networks

Comparative Study between Linear and Graphical Methods in Solving Optimization Problems

Designing a Hybrid AI System as a Forex Trading Decision Support Tool

Comparative study of Financial Time Series Prediction By Artificial Neural Network with Gradient Descent Learning Arka Ghosh

Predicting stock prices for large-cap technology companies

Stock Market Indices Prediction with Various Neural Network Models

Modeling Federal Funds Rates: A Comparison of Four Methodologies

HETEROGENEOUS AGENTS PAST AND FORWARD TIME HORIZONS IN SETTING UP A COMPUTATIONAL MODEL. Serge Hayward

Neuro Fuzzy based Stock Market Prediction System

Forecasting stock market with neural networks

Neural Network Prediction of Stock Price Trend Based on RS with Entropy Discretization

A Novel Method of Trend Lines Generation Using Hough Transform Method

One-Step and Multi-Step Ahead Stock Prediction Using Backpropagation Neural Networks

A multiple model of perceptron neural network with sample selection through chicken swarm algorithm for financial forecasting

Exploiting Corporate Governance and Common-Size Analysis for Financial Distress Detecting Models

Transcription:

Stock Market Prediction using Artificial Neural Networks IME611 - Financial Engineering Indian Institute of Technology, Kanpur (208016), India Name Pallav Ranka (13457) Abstract Investors in stock market want to maximize their profits, it would be beneficial for them if the market movement can be predicted beforehand. Artificial Neural Network approach has been used herein to predict the adjusted closing price of stocks. In this paper feed forward neural network is implemented for prediction purpose. It has been seen that results of neural network is more promising in predicting stock price that actually is not certainly predictable. Historical data of the some stocks has been used for building and training the models. Later, the results from the model has been compared with the real data to ascertain the accuracy of the model. Keywords - Stock market prediction; Neural networks; Back propagation algorithm Introduction In the past few decades, forecasting of stock market is gaining more attention as the profitability of investors in the stock market mainly depends on the predictability. If the direction of the market is successfully predicted the investors can yield enough profits out of market using prediction. Complex relationships between inputs and outputs may not always allow us to find patters. ANN is gaining much attention these days because of its capability of solving such problems. It has robust ability to discover relationship in the input data set without a priori assumption of the knowledge of relation between the input and the output data. It can be used to build model that identify unknown hidden patterns in data which can be further used for prediction purposes. Neural Network has already been successfully applied in the fields related to finance, econometrics, medicine and engineering. Instructor Prof. Kripa Shanker In the chaotic system, like stock market, in which many known as well as unknown factors affect the stock price, there is no significant mathematical relation between the factors and the price can be found. There is no law exists which governs the stock prices using the underlying factors. Taking this into consideration, application of neural networks would be very beneficial in predicting stock market. In this paper, Feed Forward Backpropagation Neural Network is used for the prediction. Feed forward Neural Networks is unidirectional connection between the neurons that means the information can flow only in forward direction. Input has been fed into first layer and with the with help of hidden layers connected to the last layer that produces the output. There is no connection among neurons in the same layer. Since information is constantly feeding forward from one layer to the next. Hence it is called feed forward neural network. The backpropagation algorithm falls into the general category of gradient descent algorithms. Purpose of gradient descent algorithm is to find the minima/maxima of a function by iteratively moving in the direction of negative slope of the function that we want to minimize/maximize. In our problem objective is to minimize the error function. In Back-propagation algorithm the network is trained by repeatedly processing the training data set and comparing the network output with the actual output to reduce the mean square error. Weights of the connections between various neurons has been modified and this process has been continued till the error comes within threshold value. It is Backpropagation algorithm as errors from output is back-propagating towards the input layer during training sessions with the objective of minimizing the mean square error. As errors Page 1 of 7

back-propagated model can be continuously updated to minimize error. Along with this, few disadvantages are also associated with backpropagation algorithm. It is not guaranteed that result always converges to global minima on the error function. Even it is not guaranteed that result always converge. If result converges, rate of convergence is very slow. Typically each backpropagation training session starts with different initial weights and biases, and different divisions of data into training, validation, and test sets. These different conditions can lead to different solutions for the same problem. Methodology The work flow for the general neural network design process has five primary steps: a) Data Collection and Preparation b) Network Creation c) Training the network d) Validating the network e) Using the network a) Data Collection and Preparation Data collection is the primary step and it is necessary in order to train, validate and test the neural network. General practice is to divide data into three subsets, namely, training set, validation set and testing set. Training set is foremost as it is used to compute the gradient and updating the network weights and biases. Validation set is used as during training phase error on validation is monitored and when the network begins to overfit the data, the error on validation phase starts rising. Then, the network weights and biases corresponding to minimum validation error can be used for the prediction purpose. For data collection yahoo finance has been used to fetch two years historical data for several stocks. Further, data has been pre-processed before it fed to a neural network. We have collected two years data starting from 2015. b) Network Creation It is crucial step for prediction, in this step network has been created with the decision about the inputs, number of layers, number of neurons in each layer, transfer function to be used, outputs etc. We have used date of prediction and opening price as an input. Three hidden layers and one output layer has been used, while number of neurons in each layer and transfer function has been decided by MATLAB itself to predict adjusted closing price of a stock as an output. Fig. 1 Structure of typical Neural Network c) Training the network The process of training a neural network involves tuning the values of the weights and biases of the network to optimize network performance (by minimizing the Mean Square Error). Out of two years historical data of stock, in the Case-I 90% of the data has been used to train the model while remaining is used to test the model. On the other hand, in the case-ii 95% of the data has been used to train the model while remaining is used to test the model. d) Validating the network Once the network is trained the network is validated using validation data to enhance the performance of network. In our case, it has been taken care by MATLAB. e) Using the network Once the network was optimized, it has been tested using the test data. In our case collected data of google (registered on NASDAQ as GOOG) Page 2 of 7

has been used to predict the adjusted closing price of stock. Results In MATLAB training will stop if anyone of the following criterion will meet: In the simulation, training epochs can reach maximum 1000 epochs. The performance measure reaches its goal. (MSE=10to-7) The gradient of the performance measure gets under a threshold. (10to-7) Case-I) 90% of the data used to train the neural network and prediction for 50 days Initial 90% of the historical data of Google from the last two years (01-01-2015 to 31-12-2016) has been used to train the neural network. For training 2 inputs, namely, date and opening price of stock has been used while output of the network is adjusted price. Then we predict stock values for 10% (approximately 50 days) of the data using Back-Propagation algorithm and compared the predicted stock prices with the actual stock prices. The average error of the simulation for 10% of the data was found to be 1.84% Fig. 2 Prediction of 50 days using 90% data Case-II) 95% of the data used to train the neural network and prediction for 25 days For this case, same historical data of Google has been used but this time initial 95 % historical data from the last two years (01-01-2015 to 31-12-2016) has been used to train the network. For training purpose same inputs and outputs has been used. Then we predict stock values for 5% (approximately 25 days) of the data using Back- Propagation algorithm and compared the predicted stock prices with the actual stock prices. In this case, the average error of the simulation for 5% of the data was found to be 0.71% Fig. 3 Prediction of 25 days using 95% data Figure 2 and 3 corresponding to Table 1 and 2 respectively, show the predicted and actual values for the Google stock. It can be seen that both the cases provide pretty good results for initial dates of prediction. While in the first case if we compare the predicted prices with the actual prices, It can be seen that after few days there is more variation of predicted price from actual price. Conclusion In a highly volatile market like Indian Stock Market, the performance of the neural network model proposed herein seems to be very useful. As, the prediction of the direction of the market with fairly high accuracy is utmost important for the investors and regulators. The ultimate goal of prediction is to increase the yield from the investment that can easily be achieved using the method proposed herein. It has been seen that neural network tool gives a promising direction of movement of the stocks. It has been seen that as we increased training data from 90% to 95% the prediction error has been reduced to.71% from 1.84%. Thus, method proposed in this paper seems very useful for investors and stock market analysts perspective as neural network gives promising result. Proposed model can be continuously updated Page 3 of 7

for the prediction at different time. So that more information can be used by network to predict the future stock price. This is recommended as with time the characteristic of the market changes and the network capture all the information and hence prediction will be more precise. References [1] J.E. Dayhoff, J.M. DeLeo, Artificial neural networks: Opening the black box. Cancer, 91 (8 Suppl.) (2001), pp. 1615 1635. [8] Robert J. Van Eyden. The Application of Neural Networks in the Forecasting of Share Prices. Finance and Technology Publishing, 1996. [9] Artificial Intelligence a modern approach (second edition) by Stuart Russell, Peter Norvig 2004 [2] T. Kimoto, K. Asakawa,M. Yoda,M. Takeoka. Stock market prediction system with modular neural network. Proceedings of the International Joint Conference on Neural Networks, 1990, pages 1 6. [3] H. Mizuno, M. Kosaka, H. Yajima, N. Komoda. Application of Neural Network to Technical Analysis of Stock Market Prediction. Studies in Informatics and Control, Vol.7, No.3, 1998, pages.111 120. [4] 18. Wong, C., and M. Versace. 2012. CARTMAP: A Neural Network Method for Automated Feature Selection in Financial Time Series Forecasting. Neural Computing and Applications 21(5):969-977. [5] Khan, Z. H., T. S. Alin and A. Hussain. 2011. Price Prediction of Share Market using Artificial Neural Network (ANN). International Journal of Computer Applications (0975 8887) 22(2). [6] Z.Tang and P.A.Fishwick, Backpropagation neural nets as models for time series forecasting, ORSA journal on computing, vol.5, No. 4, pp 374-384, 1993. [7] Mizuno, H., Kosaka, M., Yajima, H. and Komoda N. (1998), Application of Neural Network to Technical Analysis of Stock Market Prediction, Studies in Information and Control, vol.7, no.3, pp.111-120. Page 4 of 7

Appendix Case-I) 90% of the last 2 year historical data has been used to train the neural network and prediction of adjusted closing price of stock for 50 days has been shown in table (Data set link) Date Predicted Price (USD) Actual Price (USD) Error (%) 20-Oct-16 798.94 796.97 0.25 21-Oct-16 793.51 799.37 0.73 24-Oct-16 800.85 813.11 1.51 25-Oct-16 808.42 807.67 0.09 26-Oct-16 802.23 799.07 0.40 27-Oct-16 798.98 795.35 0.46 28-Oct-16 803.99 795.37 1.08 31-Oct-16 796.27 784.54 1.49 01-Nov-16 787.59 783.61 0.51 02-Nov-16 784.37 768.70 2.04 03-Nov-16 776.15 762.13 1.84 04-Nov-16 762.77 762.02 0.10 07-Nov-16 783.04 782.52 0.07 08-Nov-16 790.02 790.51 0.06 09-Nov-16 787.78 785.31 0.31 10-Nov-16 796.19 762.56 4.41 11-Nov-16 769.95 754.02 2.11 14-Nov-16 770.14 736.08 4.63 15-Nov-16 763.16 758.49 0.62 16-Nov-16 770.46 764.48 0.78 17-Nov-16 780.33 771.23 1.18 18-Nov-16 784.15 760.54 3.10 21-Nov-16 778.18 769.20 1.17 22-Nov-16 786.43 768.27 2.36 23-Nov-16 782.93 760.99 2.88 25-Nov-16 780.80 761.68 2.51 28-Nov-16 778.28 768.24 1.31 29-Nov-16 787.81 770.84 2.20 30-Nov-16 786.97 758.04 3.82 01-Dec-16 777.07 747.92 3.90 02-Dec-16 766.41 750.50 2.12 05-Dec-16 778.45 762.52 2.09 06-Dec-16 784.49 759.11 3.34 07-Dec-16 781.73 771.19 1.37 08-Dec-16 791.20 776.42 1.90 09-Dec-16 797.22 789.29 1.00 Page 5 of 7

12-Dec-16 801.76 789.27 1.58 13-Dec-16 808.31 796.10 1.53 14-Dec-16 810.97 797.07 1.74 15-Dec-16 811.19 797.85 1.67 16-Dec-16 813.50 790.80 2.87 19-Dec-16 807.26 794.20 1.64 20-Dec-16 812.05 796.42 1.96 21-Dec-16 811.66 794.56 2.15 22-Dec-16 809.46 791.26 2.30 23-Dec-16 808.65 789.91 2.37 27-Dec-16 809.33 791.55 2.25 28-Dec-16 811.66 785.05 3.39 29-Dec-16 804.33 782.79 2.75 30-Dec-16 804.07 771.82 4.18 Table-1 Google predicted and true adjusted closing price along with error from 20-Oct-16 to 30-Dec-16 Page 6 of 7

Case-II) 95% of the last 2 year historical data has been used to train the neural network and prediction of adjusted closing price of stock for 25 days has been shown in table (Data set link). Date Predicted Price (USD) Actual Price (USD) Error (%) 25-Nov-16 764.54 761.68 0.38 28-Nov-16 760.49 768.24 1.01 29-Nov-16 771.17 770.84 0.04 30-Nov-16 769.83 758.04 1.55 01-Dec-16 758.01 747.92 1.35 02-Dec-16 745.38 750.50 0.68 05-Dec-16 758.21 762.52 0.57 06-Dec-16 764.82 759.11 0.75 07-Dec-16 761.31 771.19 1.28 08-Dec-16 771.89 776.42 0.58 09-Dec-16 778.54 789.29 1.36 12-Dec-16 782.84 789.27 0.81 13-Dec-16 790.23 796.10 0.74 14-Dec-16 793.05 797.07 0.50 15-Dec-16 792.99 797.85 0.61 16-Dec-16 795.42 790.80 0.58 19-Dec-16 787.10 794.20 0.89 20-Dec-16 792.45 796.42 0.50 21-Dec-16 791.69 794.56 0.36 22-Dec-16 788.83 791.26 0.31 23-Dec-16 787.61 789.91 0.29 27-Dec-16 787.36 791.55 0.53 28-Dec-16 789.84 785.05 0.61 29-Dec-16 781.11 782.79 0.21 30-Dec-16 780.60 771.82 1.14 Table-2 Google predicted and true adjusted closing price along with error from 25-Nov-16 to 30-Dec-16 Page 7 of 7