[IEEE Comput. Soc. Press 1993 The First New Zealand International Two-Stream Conference on...

2
Trading a NYSE-Stock with a Simple Artificial Neural Network-based Financial Trading System Clarence N. W. Tan BSEE (Computers), MBA , MSISE (USC), FBSC, F Inst BA (UK) School of Information Technology, Bond University, Gold Coast, Qld. 4229, Australia email: [email protected] Abstract This paper reporb on the hypothetical trading result on an NYSE listed stock over a period of two years using an artificial neural network- based financial trading system. This system is still at a preliminary stage and many of the parameters effect on the ANN have not been fillly explored yet. However this simple ANN-based financial trading system has provided an insight into the design of a successfit1 ANN-based financial trading system as the results have been quite encouraging. 1: Introduction An Artificial Neural Network (ANN)-based financial trading system was designed, constructed and tested for its ability to predict stock price and more importantly increase trading profit. A major stock from the NYSE was selected as its data was readily available to the author and it seemed to be a good representative of the American stock market, being a major component of the S & P 500 Index as well as one of the world's largest bank. This example of an ANN-based financial trading system is still at a preliminary research stage as the effects of the various parameters on the ANN have not been fully explored yet. However the result that was obtained from this simple ANN-based financial trading system seems to suggest that the system is on the right track in the design of a successful financial trading system. This ANN system uses only technical analysis data that are derived from the past stock prices. 2: Structure of the ANN The ANN model used was a backpropagation fully connected model. The raw data consisted of the weekly high, low and close price of the stock. The closing price of the stock is the last price quoted on the New York Stock Exchange each week. The raw data was used to derive four popular technical indicators that were used as additional inputs. The technical indicators were used as most financial traders use them in making trading decisions. These seven inputs were the tnain input data used to forecast the stock price a week ahead. A time horizon window of five periods was also used thus making the total number of inputs thirty-five (7 inputs * 5 previous periods). The output of the network is the closing stock price of the following week (next week's close). In summary, the ANN model used the seven price and price derivatives inputs from the previous five weeks to predict the closing price a week ahead. Fundamental data was not used in this research because one of the objective of this research was to determine the ability of using artificial neural nets in predicting the future prices based on past prices alone. The problems of finding fundamental data that matched the price data in the correct time sequence was another reason for not considering it. Reliable stable fundamental data are also difficult to obtain as government bodies that issue the statistical economic figures frequently revised them thus making the data practically unreliable in forecasting future stock prices that may rely on the data. The ANN structure consists of thirty-five neurons in the input layer for the thirty-five inputs, thirteen neurons in the hidden layer and one neuron in the output layer. Results from using more than one hidden layer did not improve results and increased training time. One of the 294 0-81864260-2/93 $03.00 0 1993 IEEE

Transcript of [IEEE Comput. Soc. Press 1993 The First New Zealand International Two-Stream Conference on...

Page 1: [IEEE Comput. Soc. Press 1993 The First New Zealand International Two-Stream Conference on Artificial Neural Networks and Expert Systems - Dunedin, New Zealand (24-26 Nov. 1993)] Proceedings

Trading a NYSE-Stock with a Simple Artificial Neural Network-based Financial Trading System

Clarence N. W. Tan BSEE (Computers), MBA , MSISE (USC), FBSC, F Inst BA (UK)

School of Information Technology, Bond University, Gold Coast, Qld. 4229, Australia email: [email protected]

Abstract

This paper reporb on the hypothetical trading result on an NYSE listed stock over a period of two years using an artificial neural network- based financial trading system. This system is still at a preliminary stage and many of the parameters effect on the ANN have not been fillly explored yet. However this simple ANN-based financial trading system has provided an insight into the design of a successfit1 ANN-based financial trading system as the results have been quite encouraging.

1: Introduction An Artificial Neural Network (ANN)-based

financial trading system was designed, constructed and tested for its ability to predict stock price and more importantly increase trading profit. A major stock from the NYSE was selected as its data was readily available to the author and it seemed to be a good representative of the American stock market, being a major component of the S & P 500 Index as well as one of the world's largest bank.

This example of an ANN-based financial trading system is still a t a preliminary research stage as the effects of the various parameters on the ANN have not been fully explored yet. However the result that was obtained from this simple ANN-based financial trading system seems to suggest that the system is on the right track i n the design of a successful financial trading system. This ANN system uses only technical analysis data that are derived from the past stock prices.

2: Structure of the ANN The ANN model used was a backpropagation fully

connected model. The raw data consisted of the weekly high, low and close price of the stock. The closing price of the stock is the last price quoted on the New York Stock Exchange each week. The raw data was used to derive four popular technical indicators that were used as additional inputs. The technical indicators were used as most financial traders use them in making trading decisions. These seven inputs were the tnain input data used to forecast the stock price a week ahead. A time horizon window of five periods was also used thus making the total number of inputs thirty-five (7 inputs * 5 previous periods).

The output of the network is the closing stock price of the following week (next week's close). In summary, the ANN model used the seven price and price derivatives inputs from the previous five weeks to predict the closing price a week ahead.

Fundamental data was not used in this research because one of the objective of this research was to determine the ability of using artificial neural nets in predicting the future prices based on past prices alone. The problems of finding fundamental data that matched the price data in the correct time sequence was another reason for not considering it. Reliable stable fundamental data are also difficult to obtain as government bodies that issue the statistical economic figures frequently revised them thus making the data practically unreliable in forecasting future stock prices that may rely on the data.

The ANN structure consists of thirty-five neurons i n the input layer for the thirty-five inputs, thirteen neurons in the hidden layer and one neuron in the output layer. Results from using more than one hidden layer did not improve results and increased training time. One of the

294 0-81864260-2/93 $03.00 0 1993 IEEE

Page 2: [IEEE Comput. Soc. Press 1993 The First New Zealand International Two-Stream Conference on Artificial Neural Networks and Expert Systems - Dunedin, New Zealand (24-26 Nov. 1993)] Proceedings

reasons could be that the structure of the ANN was relatively small thus increasing the number of layers just increase the number of connections between neurons without increasing its learning and generalizing ability to successfully build a predictive model. The pyramid structure was used as it is the preferred structure for backpropagation neural network models.

3: Training the ANN The ANN was trained on the input data that was

discussed earlier. The total data set was for about four years, so about two years of that data was used as training set and the remaining two years were kept as test set. The actual number of data set was 264 with 165 being used as a training set and the remaining 99 for testing the ANN.

Initial training up to 10 iterations had the training set data reaching accuracy of 64% with the test set data yielding only 6% accuracy. The ANN was trained up to 2400 iterations when the accuracy of the training set had reached about 88% with the test set yielding 83% accuracy. Accuracy is defined by the number of forecasted values that were within the actual values tolerance out of the total number of values being forecasted.

4: Rule-based Structure of the Financial Trading System

A simple rule strwture was used to determine the amount of money that the ANN-based system would make. A signal is only generated when the prediciton price differs from the current closing price by US$L The reason for using one US dollar is to screen out the small moves and also to make the risk-reward ration for the trade to be worthwhile after considering commissions.

A buy (sell) signal is indicated when the next week predicted closing price is higher (lower) than the current closing price by more (less) than one US dollar. If a buy (sell) signal is indicated, the system will buy (sell) the share at the current closing price and sell (buy) the share back at the following week closing price thus closing the position.

5: Assumptions This trading system assumes that the stock can

actually be purchased a t each week's closing price even though that closing price is required as input to the ANN to generate a signal. In the practical sense, the closing price used by the ANN will be the price a priori to the

closing time which will be assumed to be the same as the closing price. No transaction costs on the trades are also assumed on the profits.

6: Results The final result after 2400 iterations can be seen on

the chart below. The final result of this ANN-based financial trading system on the training set was a n accuracy of 83% with a tolerance of 5% (or ?US$1 for the stock in question). The expected value (mean) of the stock is US$22.22 with a standard deviation of US$0.40. The price range was from US$8.63-US$34.25 for the whole data set. The total nominal profit made was US$17 on trading one share over a period of approximately two years. The rate of return over the period was computed with the mean of the share price at US$22.22 yielding 76.52%. There were 11 buys, 29 sells and 58 do nothing signals generated. This compares reasonable well with the optimal signal of 13 buys, 16 sells and 69 do nothing signals that would have made a maximum profit of US$48.88.

7: Conclusion From the result it seems that this ANN-based financial

trading systems perform quite well although there's obviously room for improvement. The assumptiom that were made should also be taken into account when evaluating this system for actual trading purposes.

Transaction costs on the trades may be significant enough to affect the profitability of the trading system. Profits can be enhanced by using smaller values as a filter instead of the US$1 but that increases the number of trades and thus transaction costs. Better results may be obtained if the number of significant inputs to the ANN is increased to include econoniic/fundaiiiental data.

Chart: Prediction after 2400 iterations ACTLUL a ~ G - ~ ~ m r . w w w ~ C n a Y

P I l ~ W O , I

Training Set Test Set

. . 36 T - .NI e*.

Training Set Test Set

295