Identifying Relative Contribution of Selected

0 downloads 0 Views 49KB Size Report
studies on stock market prediction using NN intelligence techniques have .... Stochastic Oscillator (SO): This function calculates the difference between the ... The MACD and trading volume technical indicators were used as the first two inputs.
Identifying Relative Contribution of Selected Technical Indicators in Stock Market Prediction Gary R. Weckman Industrial & Manufacturing Systems Engineering Ohio University Athens, OH 45701 Ranjeet Agarwala Department of Mechanical & Industrial Engineering Texas A&M University-Kingsville Kingsville, TX 78363 Abstract This paper investigates a sensitivity analysis of key technical indicators used in an artificial neural network (ANN) for predicting stock market trends. This process of forecasting future price movements in the stock market involves technical analysis. The data to be collected must have low noise or errors which would otherwise cause the production of inaccurate solutions/forecasts. This paper focuses on the data input selection based on the relative contribution of selected technical indicators while observing the strength of prediction and thereafter selecting a final set of inputs. Three different ANN architectures are compared along with relative weights of key technical indicators. Both the ability of each ANN model to predict stock market trends and a comparison of the contribution of indicators is determined. The models are then fit to real-world financial data over a five-year period. Sensitivity Analysis was used to extract the cause and effect relationship between the inputs and outputs of the network to improve the model’s efficiency.

Keywords Neural Networks, Forecasting, Sensitivity, Financial, Modeling.

1. Introduction The sporadic hills and valleys in today’s stock market have dictated the high level of interest in and need for research, which can accurately predict the stock market price [1, 2, 3]. The market involves the process of buying and selling financial assets and is a risky business. This was illustrated by the fall in technology stocks during 2001 causing many companies’ financial difficulties if not outright bankruptcy along with a significant negative impact on individual investor accounts. Additional risk has been introduced into the economic environment with the attack on the World Trade Center in New York on September 11, 2001. Clearly, predicting the future is becoming more difficult in the presence of such events with the possibility of more unknown events to come. With all of these risks, there is a need for better financial management that further requires more accurate forecasting of these assets [4]. To be successful in capital-management business there is a need to forecast what the market is going to do in the near future. This process of forecasting future price movements in the stock market involves technical analysis, in which there is an abundance of historical data available. Several researchers have developed applications using artificial Neural Networks (NN) to help make more informed financial decisions [5, 6, 7, 8]. These NN models have often been successfully used, receiving much attention in trading and financial forecasting of problems, such as price forecasting, stock performance, and selection [9]. Many studies on stock market prediction using NN intelligence techniques have been attempted in the past decade. These studies have used various types of NN to predict the stock index and the direction of its change [7, 10]. Schoenburg [11] analyzed the possibility of predicting stock prices on a short term, day-to-day basis with the help of NN by studying three German stocks selected at random. Baba and Kozaki [12] applied a modified NN learning algorithm to predict the Japanese Stock Market. They also used another network structure consis ting of fifteen input nodes and one output node representing the stock market tendency. Jang [13] employed dual adaptive neural network structure to predict the stock tendency for the Taiwan stock market. Recently, fuzzy logic was used to decide when to buy and sell stocks in an effort to improve the NN model’s capability to include the more subjective interpretation of technical

indicators [14].

2. Neural Networks Neural Networks are massively parallel, distributed processing systems that can continuously improve their performance via dynamic learning. NN have more recently begun to emerge as an entirely new approach for the modeling of adaptive, distributed, and mostly nonlinear systems. NN are suited for applications involving complex systems. When applied correctly, a neural or adaptive system can outperform other methods [15]. Neural computers have opened the door to many applications that are difficult for conventional computers to carry out. An artificial NN model emulates a biological NN based on the human brain. The NN resembles the human brain in two ways. It acquires knowledge through learning. This knowledge is stored within inter-neuron connection strengths known as synaptic weights. The biological NN is composed of special cells called neurons that are partitioned into groups called networks. In comparison, the artificial NN is composed of Processing Elements, which contains the transfer function, and weights (which express relative strength of the input data or transfer data from layer to layer and output). The artificial NN can appear in many configurations called architectures. These architectures may have many different transfer functions, different number of input Processing Elements (PE’s), Output PE’s, Hidden PE’s and hidden layers. Key advantages of the NN are its ability of learning, recognition, generalization, classification and interpretation of incomplete and noisy inputs (data) in both linear and nonlinear relationships. With this thought in mind, it was decided to use NN as a tool for forecasting next day stock market closing prices.

3. Neural Network Modeling and Training Training is the process of teaching the network what one wants it to learn. Neural networks are characterized by the pattern of connections between the various network layers, the number of neurons in each layer, the learning algorithm, and the neuron activation functions. Generally speaking, a neural network is a set of connected input and output units where each connection has a weight associated with it. During the learning phase, the network learns by adjusting the weights so as to be able to correctly predict or classify the output target of a given set of input samples. With supervised learning, the network is able to learn from the input and the error (the difference between the output and the desired response). This paper focuses on three key types of neural networks used for classification problems: Multilayer Perceptrons (MLPs): MLPs are layered feedforward networks typically trained with backpropagation (learning algorithm). Their main advantage is that they are easy to use, and that they can approximate any input/output map. The key disadvantages are; they train slowly, and require a large amount of training data (typically three times more training samples than network weights). Generalized Feedforward Networks (GFN): GFNs are a generalization of the MLP, which contains connections that can jump over one or more layers. In practice, generalized feedforward networks can often solve the problem much more efficiently. Radial Basis Function (RBF): RBF networks are nonlinear hybrid networks typically containing a single hidden layer of processing elements (PEs). This layer uses Gaussian transfer functions, rather than the standard sigmoid functions employed by MLPs. These networks tend to learn much faster than MLPs. The NN model was constructed using a software package called NeuroSolutions (see Figure 1) [16].

Figure 1. Generalized feedforward networks

4. Technical Trading Criteria The following provides a brief description of technical trading criteria used to perform the technical indicator calculations and stock trading exercises [7]: Relative Strength Index (RSI): This function determines the internal strength of a field using the number of upward and downward price changes over a given period of time. The Relative Strength Index is based on a ratio of the average upward changes to the average downward changes over a given period of time. RS =

Average of n day' s up closes Average of n day' s down closes

(1) 100 1 + RS Money Flow Index (MFI): This function determines the strength of money flowing into or out of a security by comparing the volume of upward and downward price changes over a given period of time. The Money Flow Index is based on the Money Ratio, which is the ratio of positive money flow to negative money flow over the given period. If the current day’s closing price is greater than the previous day’s closing price, it is considered positive money flow and vice versa. RSI = 100 −

Typical Price =

High + Low + Close 3

Money Flow = Typical Pr ice × Volume PositiveMoney Flow Money Ratio = NegativeMoney Flow 100 MFI = 100 − 1 + Money Ratio

(2)

Moving Average (MA): This function returns the moving average of a field over a given period of time. The moving average is calculated by averaging together the previous values over the given period, including the current value. n ∑ Closing Price MA = 1 n

(3)

Stochastic Oscillator (SO): This function calculates the difference between the current closing price of a security and its lowest low price, relative to its highest high price for a given period of time. Where C is the latest close, LX is the lowest low for the last 14 days, and HX is the highest high for the same 14 days. %K =

C − LX × 100 HX − LX

(4) Moving Average Convergence/Divergence (MACD): This function calculates the MACD (Moving Average Convergence/Divergence), which is the difference between a short and a long term moving average for a field. The MACD is a specific instance of a Value Oscillator and is typically used on the closing price of a security to detect price trends. EMA is the exponential moving average and α is the smoothing constant. EMA= [ α × Today' s Close ] + [( 1 − α ) × Yesterday' s EMA ] MACD = [ 0.075 EMA of Clo sin g Pr ices ] − [ 0.15 EMA of Clo sin g Pr ices ] Signal Line = 0.20 EMA of MACD

(5)

5. Application This model used the above-mentioned three NN models and the five technical indicators as inputs in predicting stock market trends. The MACD and trading volume technical indicators were used as the first two inputs. In addition, 40 inputs were added for the RSI, MFI, MA, SO indicators that were computed for periods of 5, 10, 15, 20, 25, 30, 35, 40, 45 and 50 days resulting in a total number of 42 inputs to the NN Model. The relative contribution of each technical indicator for a particular neural network model was evaluated by sensitivity analysis in helping to choose the optimum technical indicators or the range of inputs. These techniques were applied to two companies called Baxter International [BAX (NYSE)] and Bed, Bath & Beyond, Inc. [BBBY (NASDAQ)]. The data was preprocessed and input sets not covering the training period were trimmed. The data for the company’s stocks was collected for a fiveyear period from 01/03/1995 to 03/30/2001 using a software package called Trading Solutions by a company named

NeuroDimension Inc. [16].

6. Sensitivity Sensitivity analysis is a method of extracting the cause and effect relationship between the inputs and outputs of the network. After training a neural network, the sensitivity analysis feature of NeuroSolutions can be used to analyze the effect that each of the network inputs has on the network output. Each input channel to the network was varied between its mean +/- 1 standard deviation, while all other inputs were fixed at their respective means. The network output is computed and the corresponding change in the output(s) is reported. The input channels that produce low sensitivity values can be considered insignificant and can most often be removed from the network. This will reduce the size of the network, which in turn reduces the complexity and the training time, typically improving the network’s performance. This process is repeated for each input variable. A report is generated which summarizes the variation of each output with respect to the variation in each input is shown in Figure 2.

0.25

Sensitivity

0.2

0.15

0.1

0.05

0 1

3

5

7

9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41

Input based on technical indicators

Figure 2: Sensitivity by input of beginning model with 42 inputs for BAX Different models were created by reducing the number of inputs through the removal of the least sensitive variables (values less than 0.025) from the model. The selection of inputs (Number of Processing Elements) was based on the results of the Sensitivity Analysis. For Example, the NN design for the GFN Model architecture was reduced from an original 42 to its final 8 input variables after a few iterations. The final model is summarized below: Final GFN Model: Hidden Layer (1): Output Layer:

Input Processing Elements = 8 (see Figure 3) Output Processing Elements = 1 (Forecasted Closing Price) Processing Elements (PEs) = 16 PE Transfer Function = TanhAxon PE Transfer Function = TahnAxon Learning rule = Momentum with Parameter = 0.7 and Step Size = 0.1 Maximum Number of Epochs = 1000

In this work, the NeuroSolutions V4.2 software package (2002) was used to implement this design [16]. Theory of Cross Validation was not checked because only 1000 Epochs were needed to train the network. For example, in the training phase for GFN (PEs = 8) the final mean square error (MSE) measure went to approximately 0.00117 from a starting value of 0.14104.

Sensitivity

1.2 1.1 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0) I (5 RS 0) (5 A M 5) (4 A M 0) (4 A M 0) (3 A M ) (25 A M 5) (1 A e) M los (C D AC M

Input Name

Figure 3: Sensitivity by input of final model with 8 inputs

7. Results and Analysis

Closing Price Next Day

The same sets of data were trained and tested on the three types of neural network models (MLP, GFN & RBF. Fifteen hundred sets of data were used for training and 27 data points were used for testing. Graphs for training and testing were obtained for each period of time on the neural network model. The weights for the relative contribution of each input field were recorded with their averages and mean square errors. The final model was developed based on the best contributing inputs having the highest sensitivity. It was observed through the underlying data that the following 8 inputs had maximum weights and were therefore selected for training of the GFN model: 15, 25, 30, 40, 45, 50 day Moving Averages (6 inputs) Moving Average Convergence and Divergence Close (1 input) 50-day period of Relative Strength Index (1 input) Stochastic Oscillator had insignificant change in weights (0 input) Money Flow had insignificant change in weights (0 input) The above eight inputs were then used to model the BAX closing price behavior and the resulting forecast (see Figure 4) for a 27 day period resulted in following performance during testing of a minimum MSE of 10.94, a Mean Average Error (MAE) of 2.76 and a Minimum and Maximum Absolute Error of 0.066 and 6.507 respectively.

100 98 96 94 92 90 88 86 84 82 80 1

3

5

7

9

11

13

15

17

19

21

23

25

27

Days CloseND

CloseND Output

Figure 4: Comparison of actual versus forecast of next day closing stock price

It was observed that the neural network model built with the best contributing input generated the above-mentioned errors, which were considerably lower, compared to other models. Table 1 summarizes the performance of the different NN models compared for both companies (BAX and BBBY): Table 1: Comparison of NN Models NN Model (# of Inputs) MLP (42,10 ) GFN (42,8 ) RBF (42,16 )

BAX MSE 26.31, 29.89 16.55, 10.94 38.71, 37.90

BAX MAE 4.87, 5.13 3.67, 2.76 5.55, 5.79

BBBY MSE 1.102, 1.482 1.434, 1.390 29.75, 249.4

BBBY MAE 0.845, 0.955 0.956, 0.899 5.34, 15.73

8. Conclusions It was much easier to determine which of the inputs contributed most to the required output by performing the Sensitivity Analysis on all the inputs. This reduced the size of the model and the amount of data preparation without significantly loosing accuracy. In this case, the smaller model was the most efficient and the most accurate for the GFN. It was observed that the neural network model built with the best contributing indicators performed well, but more research is required to compare it to other NN architecture variations and other time series forecasting models. Some modifications could possibly enhance the accuracy of the model by incorporating some additional external factors such as consumer confidence to account for extreme events, and fuzzy logic to allow imprecise reasoning to reflect human behavior. One of the future endeavors could also be to implement other inputs like seasonality and effect of political uncertainty to get a more realistic snapshot of the market behavior.

References 1. 2. 3.

4. 5. 6. 7.

8. 9. 10. 11. 12. 13. 14.

15. 16.

Gately, Edward, 1996, Neural Networks for Financial Forecasting; John Wiley & Sons, New York. Kimoto T., Asakawa K. Y. and Takeoka M., 1990, “Stock market prediction system with modular neural network”, Proceedings of the International Joint Conference on Neural Networks, San Diego, California, pp. 1-6. Kohara, Ishikawa, and Fukuhara, Nakamura, 1997, “Stock price prediction using prior knowledge and neural networks”, International Journal of Intelligent Systems in Accounting, Finance and Management, 6 (1), pp. 1122. Shadbolt, J and Taylor, J.G., 2002, Neural Networks and the Financial Markets: Predicting, Combining and Portfolio Optimization, Springer, New York. Saad, E. W., Prokhorov, D. V., and Wunsch, D. C., 1998, “Comp arative study of stock trend prediction using time delay, recurrent and probabilistic neural networks”, IEEE Transactions on Neural Networks, 9 (6), pp. 1456-1470. Skapura, D. M., 1996, Building Neural Networks, Addison-Wesley, New York. Thawornwong S., Enke D., Dagli C., 2001, “Using Neural Networks and Technical Analysis Indicators for Predicting Stock Trends”, Proceedings of the 2001 Artificial Neural Networks in Engineering Conference (ANNIE ’01), ASME, St. Louis, Missouri. Yao, J., Li, Y. and Tan, C. L., 2000, “Option price forecasting using neural networks”, Omega, 28, pp. 455-466. Smith, K. A. and Gupta, J. N. D., 2000, “Neural networks in business: techniques and applications for the operations researcher”, Computer& Operations Research, 27, pp. 1023-1044. Kyoung-jae Kim, and Ingoo Han, 2000, “Genetic algorithms approach to feature discretization in artificial neural networks for the prediction of stock price index,” Expert System with Applications, 19 (2), pp. 125-132. Schoenburg E., 1990, “Stock price prediction using neural networks”, Neurocomputing, 2, pp. 1409-1418. Baba N., and Kozaki M., 1992, “An intelligent forecasting system of stock price using neural network”, Proceeding of the International Joint conference on Neural Networks, Vol. 1, pp. 371-377. Jang, G., Lai, F., and Parng T., 1993, “Intelligent stock trading decision support system using dual adaptivestructure neural networks”, Journal of Information Science and Engineering, 9 (2), pp. 271-297. Bogullu, V.K., Enke, D and Dagli, C., 2002, “Using Neural Networks and Technical Indicators for Generating Stock Trading Signals”, Proceedings of the 2002 Artificial Neural Networks in Engineering Conference (ANNIE ’02), ASME, pp. 721-726, November 2002, St. Louis, Missouri. Principe, J.C., Euliano, N.R., and Lefebvre, W. C., 2000, Neural and Adaptive Systems: Fundamentals Through Simulations, John Wiley & Sons, Inc., New York. TradingSolutions and NeuroSolutions, http://www.nd.com/ .

Suggest Documents