were discarded, asthe exchange rate series was then clearly non-stationary with respect tothem.Data scaling is necessary as ANN models cannot cope with the entire rangeof a time series: this data transformation was basically handled such as toallow for new highs and lows in the test data set.Data preprocessing was conducted with a view to removing underlyingtrends. Furthermore, the relevant lag structure of potential inputs wasanalysed using traditional statistical analysis, mostly the partial autocorrelation function (PACF) and the Akaike information criterion (AIC). Welooked to determine the maximum lag for which the PACF coecient wasstatistically signi®cant and the lag giving the minimum AIC. Although these
Figure 8.2 DEM/FRF ± training, validation and test data
254
Advanced Trading RulesValidation setTraining set
Figure 8.3 USD/CHF error
are, in reality, linear techniques, they were deemed to provide a useful tool forthe determination of the input lag structure.As the ANN models output was the forecast price one hour ahead,forecasting accuracy was analysed via the root mean squared error, themean absolute error, the largest absolute error and the percentage of correctdirectional forecasts of the network. Still, as forecasting accuracy does notnecessarily demonstrate economic signi®cance, we devised a simple tradingstrategy that we superimposed on the ANN models forecast (see Nabney etal., 1996). To this eect, we decided to band the price predictions into ®veclasses (see Figure 8.4): `large up', `small up', `no change', `small down' and`large down'. The `change threshold' de®ning the boundary between smalland large movements was determined according to the bid-ask spread of eachmarket. The resulting trading model is documented in the lower part of the®gure where the boxes denote the `current position' and the arrows show thetransitions carried out when the model makes the prediction given by theattached label.
Economic value of leading edge techniques for exchange rate prediction
255
Figure 8.4 The neuro trade model
8.3 EMPIRICAL RESULTS AND FURTHER DEVELOPMENTSThe results of ANN models trained from various days in March to 9September, 1994, and tested over the period 3 June to 5 October, 1993, areshown for the following six exchange rates: the GBP/DEM, the DEM/FRF,the DEM/ITL, the USD/DEM, the USD/CHF and the DEM/JPY (see Table8.1). Note the shifting of the training, evaluation and test data sets in order tominimize the impact of structural change in the marketplace.The main performance statistics reported for our ANN-based tradingmodels are the percentage annualized cumulative Gain (ACG) and the Sharperatio (SR), a measure of pro®tability weighted by the volatility of the series ofgains and losses commonly used by fund managers. We also report thenumber of days for the training, the validation and the test period, thenumber of predictions during each period, the average holding period of eachposition, the percentage of correct directional forecasts by the models, thepercentage of winning trades and the gain-to-loss ratio (i.e. the ratio of theaverage gain weighted by the percentage of winning trades over the averageloss weighted by the percentage of losing trades).Although satisfactory at ®rst sight, these results show that the same ANNmodel can see its forecasting accuracy improve at the same time as the trading
Table 8.1 Neural network trading models ± summary results
Period start
Period end
Numberofdays
Numberof predictions
Numberofpositions
Meanhours inposition
% ofcorrectdirection
% Gainpositions
ACG
Sharperatio(SR)
Gain/lossratio
GBP/DEMTrainingValidationTest
07 03 94 : 211507 12 93 : 211503 06 93 : 1115
09 09 94 : 211507 03 94 : 201527 09 93 : 2115
1296481
1032512654
381231
5.9716.425.16
53.8351.6752.37
86.8483.3070.97
17.288.9015.61
2.761.752.16
9.154.473.33
DEM/FRFTrainingValidationTest
21 03 94 : 111521 12 93 : 111503 06 93 : 1115
09 09 94 : 211521 03 94 : 101505 10 93 : 1815
1196487
958512702
7831
5.575.5011.16
50.8954.7953.35
85.71100.0080.65
0.933.9327.66
0.602.234.44
18.940.0014.33
DEM/ITLTrainingValidationTest
22 12 93 : 161507 10 93 : 151508 06 93 : 0915
09 09 94 : 161522 12 93 : 151507 10 93 : 1415
1825486
1457433694
401311
3.354.1534.18
59.5555.0949.21
80.0069.2381.82
13.3010.9718.19
1.841.222.43
10.462.49191.17
USD/DEMTrainingValidationTest
21 03 94 : 161521 12 93 : 071503 06 93 : 1115
09 09 94 : 211521 03 94 : 061505 10 93 : 1615
1206487
960512702
471742
6.9116.826.64
56.9353.0353.21
80.8588.2488.10
48.0531.0344.07
5.844.294.37
14.5625.715.98
USD/CHFTrainingValidationTest
21 03 94 : 111521 12 93 : 111503 06 93 : 1115
09 09 94 : 211521 03 94 : 101505 10 93 : 1815
1196487
958512702
472524
6.557.7614.79
55.8054.6054.92
74.4772.0087.50
34.4633.2523.04
3.263.762.16
7.966.784.61
DEM/JPYTrainingValidationTest
21 03 94 : 121512 12 93 : 121503 06 93 : 1115
09 09 94 : 211521 03 94 : 111505 10 93 : 1915
1196487
957512702
342747
5.914.816.83
54.2954.6052.35
82.3588.8985.11
32.1548.4695.08
3.824.686.64
26.8828.2716.02
Economic value of leading edge techniques for exchange rate prediction
257
Table 8.2 Naive forecasting models ± training set resultsModel d1% correctdirectionUSD/CHFDEM/FRF
49.1661.67
Model d1ACG(%)43.8112.15
Model d2% correctdirection46.7641.32
Model d2ACG(%)97.532.79
Model d1 generates a forecast Pt1  2Pt Pt 1 .Model d2 generates a forecast Pt1  Pt 1 .
performance deteriorates. This is, for example, the case of the USD/CHFmodel when one compares the validation period with the training period: thepercentage of correct direction of the ANN predictions increases from 54.6per cent to 55.8 per cent, but, at the same time, the Sharpe ratio drops from3.76 to 3.26.For benchmarking purposes, we compared the performance of our tradingmodels to that of two naive linear models and we show these results for boththe USD/CHF and the DEM/FRF (see Table 8.2).The ®rst naive model assumes that the price one step ahead is equal to twicethe current price minus the price one step back, i.e. Pt1  2Pt Pt 1 . Thesecond naive model simply assumes that the price one step ahead equals theprice one step back, i.e. Pt1  Pt 1 . As can be seen, the results of thesemodels are very negative. Note that using an AR(1) forecast where theparameter would equal one, so that Pt1  Pt , was not possible, as, fromthe point of view of a trading model, predicting the price one step ahead equalto the current price would result in no position being taken at all. On thewhole, improvements to the forecasting accuracy of our ANN models need tobe made. For example, in the case of the USD/CHF, the errors on thetraining data set are approximately symmetrically distributed about a nearzero mean, whereas the errors on the test data set are clearly biased with anon-zero mean (see Figure 8.5). Moreover, it seems that the USD/CHFprediction network may be overtrained as its trading performance consistently deteriorates over time in the test set (see Figure 8.6).This certainly implies, as advocated by Klimasauskas (1994), integrating®nancial criteria rather than statistical ones in the very selection process of the`best' network model. True, our ANN trading models are set up to minimizethe prediction error, i.e. forecast minus actual, when in reality we wish tomaximize trading pro®ts for a given level of risk. These two objectives are notabsolutely identical even though intuitively it seems reasonable to assume thata lower prediction error should result in higher pro®tability. However,backpropagation can only minimize a dierentiable function, such as squared
258
Advanced Trading Rules
Training set
Test set
Figure 8.5 USD/CHF model ± distribution of errors
Economic value of leading edge techniques for exchange rate prediction
259
Figure 8.6 USD/CHF ± test set
error; it cannot minimize a function based on loss or, conversely, it cannotmaximize a function based on pro®tability. 5Within the framework of MLP-based ANN models, a potential improvement could be the introduction of a direct connection between the inputs andthe output: this implies the existence of some linear relationship between theexplanatory variables and the output. We show the results of some experiments we conducted in this respect for the USD/CHF, the USD/DEM andthe GBP/DEM (see Table 8.3). The evidence is mixed: if direct connectionsde®nitely improve the forecasting accuracy, albeit marginally, and the trading
260
Advanced Trading RulesTable 8.3 Neural networks with direct connections ± training set results
USD/CHFUSD/DEMGBP/DEM
ACG(no directconnections)
ACG(directconnections)
% correct dir.(no directconnections)
% correct dir.(directconnections)
26.5431.845.50
22.8035.6911.78
53.3856.4553.60
54.7255.8753.95
Table 8.4 Neural networks with intercept correction ± training set results
USD/CHFUSD/DEMGBP/DEM
ACG(no correction)
ACG(correction on)
% correct dir.(no correction)
% correct dir.(correction on)
26.5431.845.50
15.2719.551.31
53.3856.4553.60
55.7758.2655.28
performance in the case of the GBP/DEM, the improvement lies either withthe trading model for the USD/DEM or with the forecasting model in thecase of the USD/CHF.We experimented with modi®cations to our basic ANN architecture. Initialresults from using recurrent networks (i.e. dynamic ANNs with a feedbackblock in the hidden layer) were disappointing but in line with ®ndingsreported elsewhere (see Barucci and Landi, 1993). Along the same lines, weexperimented with the introduction of an intercept correction (i.e. in our case,the average of the price prediction error over the last ®ve hours), an ideawhich has since been used by Burgess and Refenes (1996). Here again, theresults of the trading models proved disappointing, even if the forecastingaccuracy of the original ANNs was notably improved (see Table 8.4).Finally, we also varied the number of nodes of the ANN forecasting modelsand the change threshold of the trading model. As can be seen with the case ofthe USD/CHF, the best level of the Sharpe ratio is reached for a combinationof 15 hidden nodes and a 0.001 threshold during the training set (with 20hidden nodes and a 0.003 threshold a close competitor), but a combination of25 hidden nodes and a 0.001 threshold during the validation set (seeTable 8.5).In general, more parsimonious models seemed to produce better results fora given threshold level (e.g. the validation set results for the USD/CHF withthreshold levels of 0.003, 0.004 and 0.005), but there were clear exceptions
Economic value of leading edge techniques for exchange rate prediction
261
Table 8.5 USD/CHF model sensitivity to threshold and number of nodesUSD/CHF validation set Sharpe ratio
Hidden nodes
0.001
0.002
Change threshold0.003
0.004
0.005
1015202530
3.3042.2163.4893.5843.480
2.9932.9132.6003.0492.622
2.1032.0331.8481.8481.957
1.7421.5251.5411.5411.582
1.8711.7421.6701.6701.711
USD/CHF training set Sharpe ratio
Hidden nodes
0.001
0.002
Change threshold0.003
0.004
0.005
1015202530
2.2773.1052.7932.6282.265
2.5292.7782.7802.6122.315
2.6432.9203.1022.9332.658
2.6212.6942.7822.5842.461
2.4452.6022.7342.5372.437
also (with the 0.001 and, to a lesser extent, the 0.002 thresholds for the samedata set). Adding a second hidden layer did not improve our trading modelsperformance either, a result similar to that reported by Tan (1995) for dailyUSD/DEM data.8.4 CONCLUSIONSIn conclusion, the results we have obtained using ANN technology for highfrequency foreign exchange modelling are interesting, but much improvementis still needed.Perhaps on-line learning will help resolve the key problem of nonstationarity of the data: this is certainly an appealing approach, but apractical validation scheme will need to be developed to make it operational,as in this case no out-of-sample data set is really available.As we have seen, integrating ®nancial and not only statistical criteria intothe modelling procedure is certainly a promising avenue for future research.Clearly, forecasting accuracy and trading performance are two dierent concepts.In any case, it would seem that ANN modelling is pretty much an nparameter modelling exercise, some would even argue ANN models are(n+1)-parameter models. As such, with the ®ne tuning of so many parameters so critical to the ®nal outcome, their successful use for ®nancialmodelling is probably as much an art as it is a science.
262
Advanced Trading Rules
REFERENCESBarucci, E. and Landi, L. (1993) A neural network model for short-term interestrate forecasting: the 12-month BOT Italian auction rate, Neural NetworkWorld, 3, 625±56.Burgess, A.N. and Refenes, A.N. (1996) The use of error feedback terms in neuralnetwork modelling of ®nancial time series. In Forecasting Financial Markets(ed. C. Dunis). op. cit.Cybenko, G. (1989) Approximation by superposition of a sigmoidal function,Mathematical Control, Signals and Systems, 2, 303±14.Deboeck, G.J. (1994) (ed.) Trading on the Edge ± Neural, Genetic and FuzzySystems for Chaotic Financial Markets, John Wiley & Sons, New York.Deboeck, G.J. and Cader, M. (1994) Pre- and post-processing of ®nancial data. InTrading on the Edge (ed. G.J. Deboeck), pp. 27±44.Dunis, C. (1996) (ed.) Forecasting Financial Markets, John Wiley & Sons,Chichester.Hornik, K., Stinchcombe, M. and White, H. (1989) Multilayer feedforwardnetworks are universal approximators, Neural Networks, 2, 359±66.Klimasauskas, C.C. (1993) Applying neural networks. In Neural Networks inFinance and Investing (eds R.R. Trippi and E. Turban), Irwin Professional,London.Klimasauskas, C.C. (1994) Neural network techniques. In Trading on the Edge(ed. G.J. Deboeck), pp. 3±26.Nabney, I., Dunis, C., Dallaway, R., Leong, S. and Redshaw, W. (1996) Leadingedge forecasting techniques for exchange rate prediction. In ForecastingFinancial Markets (ed. C. Dunis).Refenes, A.N., Bentz, Y. and Burgess, N. (1994) Neural networks in investmentmanagement, Gestion Collective, Avril, 95±101.Simpson, P.K. (1990) Arti®cial Neural Systems ± Foundations, Paradigms, Applications and Implementations, Pergamon Press, New York.Tan, P.Y. (1995) Using neural networks to model chaotic properties in currencyexchange markets, Working Papers in Financial Economics, Chemical Bank, 3,8±15.Trippi, R.R. and Turban, E. (1993) Neural Networks in Finance and Investing,Probus Publishing Company, Chicago.
NOTES1. Strictly speaking, the use of an ANN model implies assuming a functionalform, namely that of the `transfer function'. However, if it contains enoughelements in its hidden layer, it will be able to accurately approximate anygiven function (Cybenko, 1989; Hornik, Stinchcombe and White, 1989).2. This very feature also explains why it is so dicult to use ANN models, asone may in fact end up ®tting the noise in the data rather than the underlyingstatistical process.
Economic value of leading edge techniques for exchange rate prediction
263
3. This function is similar to the `hyperbolic tangent' and, likewise, it varies inthe interval  1; 1. In fact, it can be shown that we have:Xjf Xj   tanh24. It is known that the training process of an ANN model can be sensitive tothe relative size of the validation versus the training set, particularly given asmall number of data points. This is not our case here. Conforming withstandard heuristics, we partition the total data set into three subsets, usingroughly 50 per cent of the data for training, 25 per cent for validation andthe remaining 25 per cent for testing. Furthermore, the very size of ourtraining set more than satis®es the heuristic rule that one should have at least®ve examples per connection (Klimasauskas, 1993).5. Genetic algorithms can in fact maximize a pro®t function. As they requirewriting the evaluation function explicitly, one can introduce into them®nancial criteria such as pro®t and risk. The genetic algorithm thenoptimizes the trading model with respect to this function.
Chapter 9Is more always better? Head-and-shouldersand ®lter rules in foreign exchange marketsP.H. KEVIN CHANG AND CAROL L. OSLER
9.1 INTRODUCTIONThe pro®tability of technical trading strategies such as ®lter rules and movingaverages has been extensively documented in a number of empirical studies.Excess returns based on technical trading rules are documented in the stockmarket by Brock, Lakonishok, and LeBaron (1992) and in the foreignexchange market by Logue, Sweeney, and Willett (1978), Dooley and Shafer(1984), Sweeney (1986), LeBaron (1991), Levich and Thomas (1993) andLeBaron (1994).In practice, however, technical traders often take positions in the marketbased on more complex trading strategies. Typically, these more complextrading rules are based on visual patterns in the data. Indeed, the names ofmany of these patterns ± `head-and-shoulders', `roundings tops and bottoms',`triangles', `diamonds', `wedges', `¯ags and pennants', `scallops and saucers' ±refer directly to the corresponding geometrical image in a chart of prices overtime.Despite the importance of these more complex image-based chart patterns,little research has been conducted concerning their pro®tability. For example,Brock, Lakonishok and LeBaron (1992: 1758) emphasize that although their`analysis focuses on the simplest trading rules, other more elaborate rules maygenerate even larger dierences between conditional returns'. The lack ofempirical testing of these more elaborate rules may stem from the apparent`subjectivity' involved in identifying such patterns, making them dicult toevaluate in any rigorous objective way. If these visual chart patterns could besystematically identi®ed, they could potentially improve upon the alreadypro®table simpler rules.This chapter investigates the incremental pro®tability of one such visuallybased chart pattern: the `head-and-shoulders' pattern, considered to be one of
Is more always better?
265
the best-known and most reliable patterns. Technical analysts claim that thispattern, identi®ed when the second of a series of three peaks is higher than the®rst and the third, indicates an imminent trend reversal. Relative to rulesknown to be pro®table, such as ®lter rules, we wish to answer a number ofquestions regarding the `head-and-shoulders' pattern: Does a more elaboraterule such as head-and-shoulders generate a greater pro®t than ®lter rules?What overlap might exist between head-and-shoulders and the simpler ®lterrules? Can head-and-shoulders be used in conjunction with ®lter rules toincrease returns still further?To test whether the head-and-shoulders rule can enhance ®lter rules'pro®tability, we use daily spot rates for six currencies versus the dollar: theyen, the mark, the Canadian dollar, the Swiss franc, the French franc and theUK pound. Our data cover most of the ¯oating rate period (19 March, 1973,to 13 June, 1994), a 21-year span that provided over 5500 daily observations.Currency markets seem especially appropriate for testing technical signals, asthey are characterized by very high liquidity, low bid-ask spreads, and roundthe-clock decentralized trading. Furthermore, because of their size, thesemarkets are relatively immune to insider trading.To complete this study, we ®rst design an objective algorithm foridentifying long and short positions based on ®lter rules and the head-andshoulders pattern. This search mechanism is programmable into a computer,and is replicable in real time, permitting simulated trading to take place basedon the technical signals we identify. We then evaluate the strategies of both®lter rules and head-and-shoulders on a stand-alone basis and whether headand-shoulders can increase the pro®tability of ®lter rules beyond currentlevels.9.2 DEFINING FILTER RULES AND HEAD-AND-SHOULDERSPATTERNSIn this section, we ®rst de®ne the two technical trading strategies studied inthis chapter ± ®lter rules and head-and-shoulders patterns. Then, we describespeci®cally how we identify such patterns in the data.9.2.1 Implementing filter rulesAs will become clear from our discussion of each, ®lter rules are far simpler toimplement than the head-and-shoulders rule. The ®lter rule requires taking along position whenever the spot rate has risen by x per cent (the ®lter size)above the previous low and a short position whenever the spot rate has fallenby x per cent from the previous high. According to the ®lter rule, as soon as atrader enters a long position, he or she begins to keep track of the maximum
266
Advanced Trading Rules
price attained since entry, updating as necessary. As soon as the price hasdropped x per cent from that maximum, the long position is closed and ashort position entered. At that point, the trader keeps track of the minimumprice attained since entering the short position, and again reverses his/herposition as soon as the price has risen x per cent above that minimum.Basic ®lter rules always involve either a long or short position in theunderlying commodity. Filter rules fall into a category sometimes referred toas `naive' trading rules, either because they are relatively easy to implement,or because they have no feedback mechanism, i.e. rules for future periods arenot updated as a function of the pro®tability of past periods. Moving-averagerules also fall into this category.9.2.2 Defining the head-and-shoulders patternTechnical analysis manuals 1 concur in the de®nition of a head-and-shoulderspattern: a sequence of three peaks with the highest in the middle, as shown inFigure 9.1. The left and right peaks are referred to as `shoulders', the centerpeak as the `head'. The straight line connecting the troughs between the headand each shoulder is referred to as the `neckline'. The head-and-shoulderspattern is `con®rmed' when the price crosses the neckline after forming theright shoulder, indicating that one should enter a short position.According to the manuals, after the price crosses the neckline, it sometimesrises back towards the neckline brie¯y before continuing on its downwardtrend. Whether or not this temporary `pull-back' to the neckline occurs,
Figure 9.1 Hypothetical head-and-shoulders pattern
Is more always better?
267
manuals indicate that the price should ultimately fall to a speci®c minimumlevel referred to as a `price objective' or `measuring objective'. This objectiveis reached when the price has fallen by a vertical distance equal to the heightof the head, i.e. the vertical distance between the neckline and the middlepeak.Head-and-shoulders can occur both at peaks (where they are `tops') and attroughs (where they are `bottoms'). All the price factors that apply to headand-shoulders tops apply equally, with a sign change, to head-and-shouldersbottoms. Our sources concur that the head-and-shoulders is speci®cally areversal pattern: a head-and-shoulders top indicates that an earlier upwardtrend is about to be followed by a price decline, while a head-and-shouldersbottom indicates that an earlier downward trend is about to be followed by aprice rise.9.2.3 An algorithm to identify head-and-shouldersTo identify head-and-shoulders tops or bottoms, we begin by tracing out azigzag pattern in the data. A zigzag pattern is essentially a modi®ed version ofthe original data in which the maxima and minima of the original data arepreserved, but in which all variation between these maxima and minima aresmoothed. Thus, a zigzag consists of peaks and troughs connected withupward and downward diagonal trend lines. We de®ne a peak as a localmaximum at least  per cent higher than the preceding trough, and a troughas a local minimum at least  per cent lower than the preceding peak, where is referred to as the `cuto'. The number of peaks and troughs in a given datasample is inversely related to the value of the cuto. An increase or a decreasein the cuto generates a dierent series of peaks and troughs, which will resultin a dierent set of head-and-shoulders patterns. 2To capture most of the head-and-shoulders patterns occurring for thesecurrencies we scan the data ten times, each time with a dierent value ofcuto. The ten dierent levels of cuto are chosen with reference to eachcurrency's volatility. 3 Speci®cally, we set one standard deviation of dailyexchange rate changes as a lower bound for cuto, to distinguish local peaksand troughs from a single day's upward or downward movement, andconsider the following higher multiples of that standard deviation: 1.25,1.50, 1.75, 2.00, 2.50, 3.00, 3.50, 4.00 and 4.50. 4 Each time we scan the data ata new cuto, we eliminate duplicate patterns. 5 Using these ten indicestypically leads us to take positions in each currency one to