## Executive Summary

The review has discussed various literature on artificial neural networks and their use on stock market forecasting. Artificial neural networks (ANNs) are used in the analysis, interpretation, and prediction of financial data. ANNs assist in the prediction of financial trends by applying case-based reasoning, learning algorithms and genetic algorithms to data to improve the accuracy and reliability of predicted results. They provide developers and investors with the tools and techniques for prediction using ratios and indices. Investors can then use these ratios to determine the most appropriate time for buying or selling securities in the stock exchange. Research on Python programming for stock market prediction is limited because most of the literature focus on the software packages developed using MatLab. This has prompted my research into modeling neural networks using MatLab language. An analysis of software packages in the market that support stock market prediction shows that MatLab can be interfaced with other programs provides object classes and methods for instantiating and invoking network elements, and prints object results into a text file. This text file can be invoked by any simulator package to convert the character strings in the text file into a model. The MatLab language is a powerful, adaptable and efficient solution that supports the conversion of financial data into models. Investors can then use these models to predict stock trends and determine when to buy or sell securities in the stock exchange.

### Table of Contents

- Literature Review………………………………………………………………………………………………………. 4

2.1 Introduction……………………………………………………………………………………………………………. 4

2.2 Stock Markets…………………………………………………………………………………………………………. 4

2.3 History and Development of Techniques for Predicting Stock Market Performance………………. 5

2.4 Artificial Neural Networks………………………………………………………………………………………….. 6

2.4.1 Predicting Stock Market Prices using Artificial Neural Networks………………………………………. 8

2.5 Software for Stock Market Price Prediction using ANN…………………………………………………… 12

2.5.1 Types of Software………………………………………………………………………………………………… 12

2.5.2 Using MatLab for ANN Modelling……………………………………………………………………………. 13

2.6 Gaps Identified………………………………………………………………………………………………………. 14

2.7 Conclusion…………………………………………………………………………………………………………….. 14

## 2. Literature Review

In a study that was carried out to find out whether the ANNN technique is reliable enough for predicting stock prices came up with results that indicated that most stock brokers trusted the technique. Through the use of questionnaires, the model was evaluated by a number of stockbrokers. The questionnaire was designed in a manner that it made it easy for the participants to fill in a couple of minutes. It required the stockbrokers to answer a number of questions that focused on the kind of techniques used by brokers, their satisfaction level with their techniques and their willingness to use the network in the future. Four out of the seven participants indicated that depended on the ANN technique by a percentage of 75, while the rest indicated that they would depend on it by about 25 percent. Five participants in the study indicated that the technique was 100 percent applicable in all stock exchange companies. It was concluded that the technique is extremely essential in predicting or in forecasting stock prices (Zhang, Jiang & Li 2004).

Another study argued that nonlinearity characters appear in mist financial data and that ANN can be an extremely useful technique to model effectively, the relations that occur between the data. According to the study, neural network can be used to mine data or information that is valuable from a historical mass of information and can effectively be used in areas and fields of finance. The study implies that because of these applications, the functions of neural networks have been increasingly popular for the last few years. ANN techniques are indicated in the study as natural methods of solving issue or problems that involve recognition of patterns and learning. As a result, it can predict stocks by detecting patterns in the information or data through recognition and learning of patterns (Roy & Roy 2008).

Another study argues that applications of ANN have been attracting attention from different discipline; stock markets and finance have not been left behind. Finance is an area that has become extremely promising for the application of ANN techniques or models to forecasting returns prices and indices. The article points out that this functionality can be attributed to the ability of ANN models to handle data that is complicated with a lot of ease coming up with great outcomes for the study (Adya & Collopy 1998).

Other studies have been carried out to test the ability of the ANN technique to forecast in the Nifty index. The investigated how effective the technique was in predicting the Nifty Index’s stock return. The findings of the study were positive that the technique is extremely effective in predicting stock returns and prices. There are numerous studies that provide support to the claim that ANN techniques can be extremely useful in predicting stocks (Hassoun 1995).

# 2.1 Introduction

There are various literature on the application of artificial neural networking techniques on financial data. Artificial Neural Networks (ANN) are popularly used for analyzing and interpreting financial data (Kim 2006, p.519). Artificial neural network algorithms involve the application of case-based reasoning, learning algorithms and genetic algorithms to large and noisy data to improve the accuracy and reliability of predicted results. The algorithms aim to increase the closeness between predicted results and network values by reducing collected data into manageable data sets and condensing them prior to training (Kim 2006, p.519). The paper analyzes literature on the application of artificial intelligence techniques to predict prices in the stock market. It shall discuss the meaning of ANN, the history and development of prediction techniques, application of ANN to stock market prediction, types of software used and the findings on the use of MatLab for forecasting stock market prices. The objective of the paper, therefore, is to develop effective ANN software that can be used in prediction of stock prices, and also to look at some of the applications of MatLab in the development of ANN models.

# 2.2 Stock Markets

Stock market information is fundamental to the development of techniques for predicting trade prices. This information may highlight external factors affecting the performance of stock prices in the stock exchange. Baker & Wurgler (2008, p.6) propose that ANN developers and stock investors should consider the effect of social and economic factors on buy or sell decisions. They should also recognize the impact of the society and economy on stock prices. This will help the developers and investors understand how low capitalization, price unpredictability, strength of corporate growth strategies, recession and company profits affect the performance of stocks. Additionally, the information will facilitate rationalization of the role of environmental factors on the valuation and predictability of future stock performance.

# 2.3 History and Development of Techniques for Predicting Stock Market Performance

The methods used to predict stock price indices have drastically changed over the years. Fok, Tam and Ng (2008, p.1) suggest that while previously stock market forecasting relied on statistical methods such as moving-average, technical analysis and linear programming techniques, these methods are not suitable for current stock markets. The traditional techniques were effective at the time because stock market data was predictable and did not produce large data sets. According to Tsang et al. 2007 (p.454), the technical analysis method uses past prices to predict future price on the assumption that history will repeat itself. This method has a higher risk of producing subjective predictions. This is because the technical analysis method does not validate data input using statistical methods and lacks tools for rationalizing the procedures used. The moving-averages technique demonstrates similar characteristics. Tsang et al (2007, p.454) argues that although the moving-averages algorithm caters to non-linear data, it does not provide accurate results for long-term forecasting. They hold that the algorithm is suitable for large, non-noisy data sets to generate short-term predictions of stock prices.

Modern techniques using artificial neural networks have compensated for the drawbacks experienced in traditional forecasting methods. This is because ANNs have been designed to accommodate the unpredictability of information, noise and large amount of historical data on stock price trends (Tsang et al. 2007, p.453). Studies show that traditional prediction methods are not effective because stock market indicators are not linear, making it difficult to obtain accurate predictions (Fok, Tam & Ng’s 2008, p.1). In addition, traditional methods cannot accommodate assumptions on the distribution of data, relationships between variables and unpredictability of financial indicators. Consequently, the methods produced inaccurate predictions due to the inclusion of errors from noisy and unfiltered data.

# 2.4 Artificial Neural Networks

Neural networks are fundamental to the generation of accurate and relevant predictions in the financial market. Fok, Tam and Ng (2008, p.1-2) state that neural network algorithms are preferred methods for generating data forecasts and multivariate financial analysis because they are tolerant to noise, unstable data and unpredictable parameter values during instance selection and simulation modeling. Their support for neural network algorithms emanates from a case study of stock exchanges in the United States, Hong Kong, China and Europe. Tsang et al.’s (2007, p.453) case study on the Hong Kong stock exchange supports the use of artificial neural networks for forecasting purposes. Their case study provides several measures for determining the neural network designs. The measures include output goals, types of inputs needed, the networking architecture, training and testing methods, an optimal topology for the network and procedures for evaluating results (p.456).

Kim (2006, p.519) claim that data mining techniques are effective methods for developing neural networks for forecasting purposes. Data mining techniques of neural networking have evolved over the years to eliminate computational inefficiencies of traditional methods. These techniques use learning algorithms to select sample data to represent features of the population, known as *instance selection *(Kim 2006, p.519). Instance selection is performed on data because it facilitates the reduction of data for effective learning. This helps eliminate noisy and irrelevant data by segmenting the samples into manageable data instances. However, its main drawback is the high cost of computation and storage during prediction. To reduce these costs, Kim (2006, p.519) proposes that effective reduction should be performed on the data sets. He recommends a fused ANN model using a genetic algorithm for forecasting financial systems. The model uses advanced instance selection techniques to reduce factual dimensions, noise and irrelevant data. Unlike other ANN algorithms, this model uses weights to mitigate the drawbacks of gradient algorithms (p.519).

According to Fok, Tam and Ng (2008, p.1), modern prediction techniques using ANN techniques, such as the algorithm and data mining, are recommended for generating accurate predictions of financial market performance. This is because the techniques can accommodate large amounts of financial data and provide non-linear solutions for stock market forecasting (Kanas & Yannopoulos 2001; Kara, Boyacioglu & Baykan 2011). Fok, Tam, and Ng (2008, p.1) note that ANN techniques are flexible because they allow users to input unpredictable and noisy data through filtering and reduction. This segments stock price data into manageable data sets. Moreover, learning algorithms are valuable because they analyze and incorporate historical data to identify relationships between variables, analyze current trends in market indicators using historical data and forecast future behavior of stock markets. Kim (2006, p.519) concurs that neural network algorithms are useful because they eliminate the inefficiencies of traditional forecasting methods by reducing the loads on computation and storage, and increasing the accuracy of predictions.

Case-based reasoning algorithms can be used in artificial neural networking. Kim (2006, p.520) proposes that case-based reasoning structures should be used for selecting instances from data sets. This is because the case-based structures lower the operational and computation costs incurred by neural networks by reducing the number of repetitive and irrelevant cases. Genetic algorithms are also significant to artificial neural networks. They improve ANNs by facilitating the selection of network topologies, optimizing the subsets of data and help determine the quantity of hidden layering. Kim (2006, p.519-520) proposes the use of genetic algorithms for mining financial information. This is because a genetic algorithm can be used to avoid reaching narrow optimums in artificial neural networks. The author presents a generated prototype algorithm that uses genetic algorithms to develop a model for financial forecasting. The generated prototype algorithm can be used to modify a restricted set of instances in artificial neural network predictions to generate feature-map classifications (Kim 2006, p.520).

# 2.4.1 Predicting Stock Market Prices using Artificial Neural Networks

Research on the prediction of stock market prices using ANN is sufficient (Mostafa 2010). Historical research on stock market forecasting can be traced to the 1990s, as observed in Kimoto et al.’s (1990) study on learning methods and predictions of the Tokyo Stock Exchange prices (cited in Kim 2006, p.521). This study aimed to evaluate the effectiveness of learning algorithms in estimating returns on stock prices. However, it did not provide any statistical evaluations to support empirical analysis on the findings. Other than learning algorithms, historical research relied on logical programming to predict stock prices. The research predicted the use of ANNs in predicting stock market prices using Boolean operations on data sets to produce rule sets (Kim 2006:521).

Modern ANN algorithms incorporate features to reduce or filter the amount of stock pricescollected (Kim 2006, p.521-522). This is because financial data is very noisy and variable, increasing the difficulty of training and obtaining accurate predictions. Therefore, the chosen algorithm should allow users to control and reduce data inputs. Kim (2006, p.523) provides a genetic algorithm for evaluating the performance of the Korean stock exchange. His research shows that training on samples in instance selection using genetic algorithms demonstrate lower error rates compared to samples from neural network selection. By using instance selection, the accuracy increased allowing progressive learning. Kim recommends that a genetic algorithm should be applied in neural network prediction to select instances and optimize the learning technique used.

The author presents three techniques used to classify data instances: *Two-level classifiers, condensed nearest neighbour rule* and the *generated prototype *technique. The condensed neighbour algorithm requires that each element of a training set (*T*) is close to an element in a subset (*S*) of the same class than of a different class. This algorithm has been further modified to form the *edited nearest neighbor* and *selective nearest neighbor* algorithms (Kim 2006, p.520).

While Kim’s research uses a two-level classification algorithm to select instances, Fok, Tam and Ng’s (2008, p.2) approach uses a multi-layered classification technique. The multi-layered approach recognizes that neural networks should consist of input, output and hidden layers. To facilitate connection between the layers, they suggest that interconnected weights should be used. The weights are obtained from a set of training algorithms on data sets, which aim to increase the accuracy between predictions and actual network output.

The multi-layered approach uses the standard back propagation algorithm to map input parameters to output values. The algorithm uses two formulas for mapping:

Yp = *f *(W_{o}h_{p} + θ_{o}) and h_{p} = *f (*W_{h} x_{p} + θ_{h}),

Where *W _{o}* and

*W*represent the weights of the input and hidden layers,

_{h}*h*represents the vector of the hidden layer, and

_{p}*o*and

*h*represent the output and hidden layers respectively (Fok, Tam & Ng’s 2008, p.2). To minimize the computational costs, they recommend that simulators should apply the following cost function: E = ½ Σ ( t

_{p}− y

_{p})T (t

_{p}− y

_{p}), where t

_{p }represents the targeted output parameter for the pattern (represented by

*p*). The authors recommend that further evaluation should be performed using the graduate descent method to modify the weight of connections between neural network nodes. This will ensure that forecast results have an 80 percent accuracy rate in predicted values compared to networked values (Fok, Tam & Ng’s 2008, p.4).

Fok, Tam and Ng’s (2008, p.1) comparison of learning algorithms to predict stock price behaviour shows that the neural network back propagation algorithm provides higher prediction accuracies than linear regression techniques. Tsang et al. (2007, p.453) concur that the back propagation is a useful technique for simulating neural network models in financial forecasting. Their evaluation of the technique’s use in the Hong Kong stock exchange show a high success rate (above 70 percent), which demonstrates its reliability in providing accurate predictions on stock prices

Vanstone & Finnie (2009, p.1) provide a methodology for designing ANNs for stock markets. The methodology separates the process for generating training samples into distinct steps. This allows developers to test each step for correctness and accuracy before proceeding to the next. This testing may be carried out in the context of the stock trading system or out of its context. The methodology aims to address the three core roles of the stock market training system, namely: entry and exit rules, risk control and financial management (p.7). It uses ratios and indexes, instead of actual prices and volumes, to predict the trend of stocks. To test the architecture of the neural network in the context of the stock system, the methodology requires input of ratios as the filter ratio, timeframe (in years), number of securities or stocks to be screened or deduced, probability of a win, probability of a trade loss, average amount that can be won or lost and expectancy ratio.

The following formula can be used to determine the expectancy ratio of a security or investment: *Expectancy ratio = ((AW*

__×__

*PW)*+ (*AL*×*PL))*|AL|

Where *AW* is the average amount gained, *PW *is the likelihood of a win, *AL* is average amount lost and* PL* is likelihood of a loss (Vanstone & Finnie 2009, p.11). The expectancy ratio can then be used to determine when to buy or sell stocks in the exchange market. Since the primary aim of stock market trading is to generate profit, the neural network should be subjected to external benchmarking using ratios such as number of trades, payoff index, net profit, annual profit, portfolio stability, Ulcer index, Luck coefficient and Sharpe ratio (Vanstone & Finnie 2009, p.12).

While the stock forecasting methods discussed previously focus on the use of artificial neural networks for predicting prices, few address the influence of environmental factors on stock patterns. Assaleh, El-Baz and Al-Salkhadi’s (2011, p.82) study evaluates the role of political, social and psychological factors in forecasting stock prices. They propose an advanced ANN approach using the Polynomial Classifiers theory to forecast stock prices in the Dubai foreign exchange. In comparison to the ANN approach, the polynomial classifier approach produces better results than neural networks. In the context of economic factors, Weckman et al. (2008, p.36) propose that ANN developers take into consideration the different types of investors in the securities industry including consumers, private businesses, healthcare, financial, energy, manufacturing and telecommunications industries. Baker & Wurgler (2008, p.10) recommend that ANN techniques should also incorporate social factors (such as investor reaction) in predicting stock trends.

# 2.5 Software for Stock Market Price Prediction using ANN

# 2.5.1 Types of Software

Various types of software can be used to assist researchers to predicting stock market trends using artificial neural networks. Drewes, Zhou and Goodman (2009, p.1) suggest that ANN developers should use off-the-shelf packages such as MatLab, Brainlab, NeoCortical, PyNET, PyGENESIS, PyNN, and PCSIM (Brüderle et al. 2009). The packages help researchers and professionals evaluate complex neural networks using large data sets. Drewes, Zhou and Goodman (2009, p.1) also recommend that developers should use the Brainlab software, built on the MatLab, for the design, simulation and analysis of neural network models. In addition to providing an abstraction for creating three-dimensional models, Brainlab supports testing using regression techniques, generates algorithms and reports of models, interfaces for robotics and programming using the C or C++ programming language (Drewes, Zhou & Goodman 2009, p.1-2).

The NeoCortical Simulator is also used for modelling complex neural networks. Drewes, Zhou & Goodman (2009, p.1) recommend its use because of its performance and speed efficiency in simulating spiking neural networks. The software also has the capability of simulating large and diverse models. The NeoCortical Simulator also has its drawbacks. The software cannot be adapted, has inadequate tools for experimentation and uses restrictive interfaces. It uses a low-level programming language, which makes it difficult for non-experts to understand and modify. Moreover, the NeoCortical requires external tools to manage the scope of experiments and it provides a restrictive interface for modelling neural networks.

# 2.5.2 Using MATLAB for ANN Modelling

A study was carried out to determine the structure of two different structures of ANN for two stock price forecasting models. The best architecture or design of the neural network models was established through a number of steps of testing and training of the models. In this particular study, a feed- forward which was three- layered was utilized and trained though the use of error backpropagation. The training using backpropagation training with delta learning rules that are generalised is an algorithm with an iterative gradient that is designed to reduce the mean square error that occurs between desired outputs and the actual output of the utilised feed- forward neural network which is multilayered. In this case, each layer is completely connected to the prior layer, but there are no other connections made by this layer. After the completion of the process of training of the neural network, the MLP weights are ready to use and frozen in the mode of testing (Hassoun 1995).

For the purposes of achieving the appropriate configuration of the model all MatLab activation functions that is hardlim. Compet, tansi, poslin, logsig, radbbas, satlin, purelin, tribas, and satlins were compared with the similar test and training data in the study. The differences that occurred in the test and training errors in all the activation functions of MatLab were not of significant means. Functions with mostly of low level error, logarithmic sigmoid, hyperbolic tangent sigmoid, and purelin were taken and compared for the final models. It was found that these functions of MatLab could be used in coming up with different kinds of ANN models, and that these models could be useful in a number of functions. The study concluded that MatLab was a significant modelling method for subsystems of ANN that could be significant in various applications including stock prices predictions (Mills 1990).

# 2.6 Gaps Identified

The literature on MatLab toolboxes for stock market prediction is limited because most of the literature focuses on the software packages developed using Python. This has prompted my research into modelling artificial neural networks using the toolbox. Consequently, the focus of my dissertation is to develop a stock market prediction program using MatLab toolbox.

# 2.7 Conclusion

This paper has analyzed various literatures on ANNs and their use on stock market forecasting. Artificial neural networks are used in the analysis, interpretation and prediction of financial data. ANNs assist in the prediction of financial trends by applying case-based reasoning, learning algorithms and genetic algorithms to data to improve the accuracy and reliability of predicted results. They provide developers and investors with the tools and techniques for prediction using ratios and indices. Investors can then use these ratios to determine the most appropriate time for buying or selling securities in the stock exchange. The literature shows that a few of the ANN software in the market is developed using MatLab tools. MatLab tools can be useful in determining and creating different sets of functions that can in turn be used to come up with different models of ANN. These ANN models can be used for different functions and in different applications. The MatLab tools are powerful, adaptable and efficient applications that support the conversion of financial data into models. Investors use these models to predict stock trends and determine when to buy or sell securities in the stock exchange.

References

Adya, M & Collopy, F 1998, ‘How Effective are Neural Networks at Forecasting and Prediction? A Review and Evaluation,’ *Journal of Forecasting*, vol. 17, no.5-6, pp.481-495.

Assaleh, K, El-Baz, H & Al-Salkhadi 2011, ‘Predicting stock prices using polynomial classifiers: The case of Dubai financial market’, *Journal of Intelligent Learning Systems and Applications, *vol.3, pp.82-89.

Baker, M & Wurgler, J 2006, ‘Investment sentiment in the stock market’, *Journal of Economic Perspectives, *pp.1-37. Accessed from http://www.people.hbs.edu/mbaker/cv/papers/

Fok, W, Tam, V & Ng, H 2008, ‘Computational neural network for global stock indexes prediction’, Proceedings of the World Congress on Engineering London, UK, 2-4 July.

Hassoun, M H 1995, ‘Fundamentals of Artificial Neural Networks’, Institute of Technology Press, USA: Massachusetts, pp. 57-134.

Kanas, A & Yannopoulos, A 2001, ‘Comparing linear and nonlinear forecasts for stock returns’, *International Review of Economics & Finance, *vol.10, no.4, pp.383-398.

Kara, Y, Boyacioglu, M & Baykan, Ӧ 2011, ‘Predicting direction of stock price index movement using artificial intelligence support machines: The sample of Istanbul Stock Exchange’, *Expert Systems with Applications, *vol.38, no.5, pp.5311-5319.

Kim, K 2006, ‘Artificial neural networks with evolutionary instance selection for financial forecasting’, *Expert Systems with Applications, *vol.30, pp.519-526.

Mills, T C 1990, ‘Non-linear Time Series Models in Economics’, *Journal of Economic Surveys,* vol. 5, pp. 215–241.

Mostafa, M 2010, ‘Forecasting stock exchange movements using neural networks: Empirical evidence from Kuwait’, *Expert Systems with Applications*, vol.37, no.9, pp.6302-6309.

Roy, P & Roy, A 2008, ‘Forecasting Daily Returns of Nifty Index – Using the Method of Artificial Neural Network,’ *FFMI 2008 Conference Proceedings*, pp. 787-800.

Tsang, P, Kwok, P, Choy, S, Kwan, R, Ny, S, Mak, J, Tsang, J, Koong, K & Wong, T 2007, ‘Design and implementation of NN5 for Hong Kong stock price forecasting’, *Engineering Applications of Artificial Intelligence, *vol.20, pp.453-461.

Vanstone, B & Finnie, G 2009, ‘An empirical methodology for developing stock market trading systems using artificial neural networks,’ retrieved from http://epublications.bond.edu.au/infotech_pubs/21/

Weckman, G, Lakshminarayanan, S, Marvel, J & Snow, A 2008, ‘An integrated stock market forecasting model using neural networks’, *International Journal of Business Forecasting and Marketing Intelligence*, vol.1, no.1, pp.30-49.

Zhang, D, Jiang, Q & Li, X 2004, ‘Application of Neural Networks in Financial Data Mining, International,’ *Journal of Computational Intelligence*, vol. 1, no.2, pp. 116-119.

PLACE THIS ORDER OR A SIMILAR ORDER WITH GRADE VALLEY TODAY AND GET AN AMAZING DISCOUNT