‹ Volver a la ficha Doc. dt-1999-07

On the profitability of technical trading rules based on artifitial neural networks: Evidence from the Madrid stock market by Fernando Fernández-Rodríguez* Christian González-Martel* Simón Sosvilla-Rivero** DOCUMENTO DE TRABAJO 99-07

June, 1999

* Universidad de Las Palmas de Gran Canaria. ** FEDEA and Universidad Complutense de Madrid.

ABSTRACT

In this paper we investigate the profitability of a simple technical trading rule based on Artificial Neural Networks (ANNs). Our results, based on applying this investment strategy to the General Index of the Madrid Stock Market, suggest that, in absence of trading costs, the technical trading rule is always superior to a buy-and-hold strategy for both “bear” market and “stable” market episodes. On the other hand, we find that the buy-and-hold strategy generates higher returns than the trading rule based on ANN only for a “bull” market subperiod.

JEL classification numbers: G10, G14, C53

KEY WORDS: Technical trading rules, Neural network models, Security markets

1. Introduction

In recent years, there has been increasing interest in testing for predictable components in stock prices (see, Fama, 1991, for a review). The existence of patterns in asset prices has been exploited to improve stockmarket forecastability using different techniques (see, e. g., Fernández-Rodríguez et al., 1997). One of the approaches that have been tried to improve the ability of forecasting security markets is the Artificial Neural Networks (ANNs) [see Van Eyden (1995), for a review and Gençay (1998) for an application). These ANNs rely on their powerful pattern recognition properties to produce short-term predictions of the time series, therefore avoiding the need to specify an explicit econometric model to represent the time series.

The aim of this paper is to investigate the profitability of using artificial neural networks in security markets. To that end, the ANNs predictions are transformed into a simple trading strategy, whose profitability is evaluated against a simple buy-and-hold strategy based on a random walk model. We have applied this investment strategy to the General Index of the Madrid Stock Market, using data for the 2 January 1966-12 October 1997 period (6931 observations).

The paper is organised as follows. Section 2 presents the model used to generate predictions. The empirical results are shown in Section 3. Finally, Section 4 provides some concluding remarks.

2. The model

ANNs models simulate paralell computational structure whith highly interconnected simple units, called neurons. The simplest ANN model is the feedforward network, where information is passed from the point of entry (at the so-called “input layer”), assigned a weight and passed to a further layer of hidden neurons. A further set of weights can be assigned to this hidden information, and so on, until reaching the final layer of the system (the “output layer”) which represents the forecast (see Kuan and White, 1994).

In this paper, we use the following three-layer feedback network

\[y _ {t} = G \left(a _ {0} + \sum_ {j = 1} ^ {4} a _ {j} F \left(b _ {0 j} + \sum_ {i = 1} ^ {9} b _ {j i} r _ {t - i}\right)\right)\]

There are nine inputs (corresponding with the returns in the previous nine days: , one hidden layer with four units, and one output layer with a single neurone ( ). Any hidden layer unit receives the weighted sum of all inputs and a bias term and produces an output signal through the hidden transfer function (F), where is the weight of its connection from the ith input unit to the jth hidden layer unit. In the same way, the output unit receives the weighted sum of the output signals of the hidden layer, and produces a signal through the output transfer function (G), where is the weight of the connection from the jth hidden layer unit. The final output will be a value in the (-1, +1) interval. A value greater than 0 will be used as a buy signal, while a value lesser than 0 will be used as a sell signal.

The values of the weights are determined by an iterative learning process and their transformation at each successive layer determined by a specific kind of transfer function. Regarding the training process, the most widely used is error backpropagation, a recursive gradient descent method that minimises the sum of squared errors of the system by moving down the gradient error curve. As for the trasformation functions, F will be a logarithmic function and G a hyperbolic tangent function.

Since stock market prices present a tendency to generate alternating episodes of generally rising or generally falling prices (so-called "bull" and "bear" markets), we have examined the performance of the ANN in three different subperiods: (I) 10/2//91 to 10/2/92, (II) 7/14/94 to 7/13/95 and (III) 10/23/96 to 10/15/97. As shown in Figure 1, subperiod I corresponds to a downwards trend, subperiod II presents a relative stable episod, and III exhibits an upwards movement in the index. For each subsample, the ANN model, using all previous observations in the learning process, produces forecasts 250 day ahead (a year of price data in daily frequency), long enough to reduce the effects of data snooping.

Figure 1: The General Index of Madrid Stock Exchange

Figure 1: The General Index of Madrid Stock Exchange

3. Empirical results

In order to evaluate the forecast accuracy of the ANN predictors, we first compute both the percentage of correct predictions and the Pesaran and Timmermann (1992)´s non-parametric test proportion of correctly predicted signs.

Latter, to assess the economic significance of the ANN predictors as a simple technical trading strategy, we consider the estimated total return of such strategy:

\[\hat {R} _ {t} = \sum_ {t = n + 1} ^ {n + \rho + 1} \hat {y} _ {t} r _ {t}\]

where is the out-of-sample horizon and the recommended position which takes either a value of -1 (for a short position) or +1 (for a long position), and n is the number of observations. Note that we are not considering transaction costs.

Given that in a random-walk market no mechanical trading rule would consistently outperform a buy-and-hold policy, we compare both strategies. The returns on a simple buy-and-hold strategy are given by:

\[R _ {b} = \log \left(\frac {P _ {t + \rho}}{P _ {t}}\right)\]

where indicates the holding period, and .and are prices of the security at time t and respectively.

In addition to total returns, we also consider other two profitability measures: the ideal profit and the Sharpe ratio. The ideal profit measures the returns of the trading system against a perfect predictor and is calculated by:

\[R _ {i} = \frac {\sum_ {t = n + 1} ^ {n + \rho + 1} \hat {y} _ {t} r _ {t}}{\sum_ {t = n + 1} ^ {n + \rho + 1} \left| r _ {t} \right|}\]

As can be seen, if the indicator variable takes the correct trading position for all observations in the sample. If all trade positions are wrong, then the value of this measure is . An value is considered as a benchmark to evaluate the performance of an investment strategy. Regarding the Sharpe ratio, it is simply the mean return of the trading strategy divided by its standard deviation:

\[S _ {R} = \frac {\mu_ {\hat {R} _ {T}}}{\sigma_ {\hat {R} _ {T}}}\]

The higher the Sharpe ratio, the higher the return and the lower the volatility.

The results for all these tests are reported in Table 1. As can be seen, the sign predictions for the recommended positions range in the 54-58%, indicates a performance better than a random walk directional forecast. Furthermore, the Pesaran-Timmemann tests are significant at the 1% level for the subperiods II and III. Regarding total returns, the trading rule based on the ANN dominate the buy-and-hold strategy in subperiods I (48% versus –40%) and II (27% versus 0.19%), while the opposite is truth for subperiod III (29% versus 44%). The Sharpe ratio is relatively higher in the bear market subperiod (0.19) than in the remainder subperiods (0.13 and 0.11). Consistently, the ideal profit is high in subperiod I (0.25) and remains in similar order in the other two subperiods, being always greater than zero.

Table 1: Out-of-sample tests

TestsSubperiod I (bear market)Subperiod II (stable market)Subperiod III (bull market)
Sign predictions0.540.570.58
Pesaran and Timmerman0.972.24*2.26*
Total return0.480.270.29
Ideal profit ratio0.250.170.14
Sharpe ratio0.190.130.11
Buy and hold return-0.400.00190.44

Note: * denotes significance at the 1% level.

4. Concluding remarks

In this paper we have investigated the profitability of simple technical trading rule based on ANN models. Our results, based on applying this investment strategy to the General Index of the Madrid Stock Market, suggest that, in absence of trading costs, the technical trading rule is always superior to a buy-and-hold strategy for both “bear” markets and “stable” market episodes. On the other hand, we found that the buy-andhold strategy generates higher returns than the trading rule based on ANN for a subperiod presenting upwards trend (“bull” markets). These results are in line with those presented in Fernández-Rodríguez et al. (1999) when applying nonlinear predictors to the Nikkei Index.

References

  1. Fama, E. F., 1991, Efficient capital markets: II, Journal of Finance 46, 575-1617.
  2. Fernández-Rodríguez, F., Sosvilla-Rivero, S. and García Artiles, M. D., 1997, Using nearest-neighbour predictors to forecast the Spanish stock markets, Investigaciones Económicas 21, 75-91.
  3. Fernández-Rodríguez, F., Sosvilla-Rivero, S. and García Artiles, M. D. , 1999, Nearest Neighbour forecast for the Nikkey index, forthcoming in Japan and the World Economy.
  4. Gençay, R., 1998, Optimization of technical trading strategies and the profitability in security markets, Economics Letters 59, 249-254.
  5. Kuan, C. M. and White, H., 1994, Artificial neural networks: An econometric perspective, Econometric Reviews 13, 1-91.
  6. Pesaran, M. H. and Timmermann, A., 1992, A simple nonparametric test of predictive performance, Journal of Business and Economic Statistics 10, 461-465.
  7. Van Eyden, R. J., 1995, The Application of Neural Networks in the Forecasting of Share Prices (Finance & Technology Publishing , Haymarket, VA).

COLECCION RESUMENES

98-01: “Negociación colectiva, rentabilidad bursátil y estructura de capital en España”, Alejandro Inurrieta.

TEXTOS EXPRESS

99-01: “Efectos macroeconómicos de la finalización de las ayudas comunitarias”, Simón Sosvilla-Rivero y José A. Herce.

DOCUMENTOS DE TRABAJO

99-07: “On the profitability of technical trading rules based on artifitial neural networks: Evidence from the Madrid stock market”, Fernando Fernández-Rodríguez, Christian González-Martel y Simón Sosvilla-Rivero.

99-06 “Job bust, baby bust: The Spanish case”, Namkee Ahn y Pedro Mira.

99-05: “Technical analysis in the Madrid stock exchange, Fernando Fernández-Rodríguez, Simón Sosvilla-Rivero y Julián Andrada-Félix.

99-04: “Convergencia en precios en las provincias españolas”, Irene Olloqui, Simón Sosvilla-Rivero, Javier Alonso.

99-03: “Inversión y progreso técnico en el sector industrial de la Comunidad de Madrid”, Ana Goicolea, Omar Licandro y Reyes Maroto.

99-02: “Reducing Spanish unemployment under the EMU”, Olivier J. Blanchard y Juan F. Jimeno.

99-01: “Further evidence on technical analysis and profitability of foreign exchange intervention”, Simón Sosvilla-Rivero, Julián Andrada-Félix y Fernando Fernández-Rodríguez.

98-21: “Foreign direct investment and industrial development in host countries”, Salvador Barrios.

98-20: “Numerical solution by iterative methods of a class of vintage capital models”, Raouf Boucekkine, Marc Germain, Omar Licandro y Alphonse Magnus.

98-19: “Endogenous vs exogeneously driven fluctuations in vintage capital models”, Raouf Boucekkine, Fernando del Río y Omar Licandro.

98-18: “Assesing the economic value of nearest-neighbour exchange-rate forecasts”, F. Fernández-Rodríguez, S. Sosvilla-Rivero y J. Andrada-Félix.

98-17: “Exchange-rate forecasts with simultaneous nearest-neighbour methods: Evidence from the EMS”, F. Fernández-Rodríguez, S. Sosvilla-Rivero y J. Andrada-Félix.

98-16: “Los efectos económicos de la Ley de Consolidación de la Seguridad Social. Perspectivas financieras del sistema tras su entrada en vigor”, José A. Herce y Javier Alonso.

98-15: “Economía, mercado de trabajo y sistema universitario español: Conversaciones con destacados macroeconomistas”, Carlos Usabiaga Ibáñez.

98-14: “Regional integration and growth: The Spanish case”, Ana Goicolea, José A. Herce y Juan J. de Lucio.

98-13: “Tax burden convergence in Europe”, Simón Sosvilla-Rivero, Miguel Angel Galindo y Javier Alonso.

98-12: “Growth and the Welfare State in the EU: A cusality analysis”, José A. Herce, Simón Sosvilla-Rivero y Juan J. de Lucio.

98-11: “Proyección de la población española 1991-2026. Revisión 1997”, Juan Antonio Fernández Cordón. y Juan J. de Lucio.