Theil-U are used. They are constructed to lie within [0,1], zero indicating a perfect ﬁt.20A buy signal is to buy euros at the current price or continue holding euros, while a sell signal is to sell eurosat the current price or continue holding US dollars.
32
Applied Quantitative Methods for Trading and InvestmentTable 1.16 Statistical performance measures
Performance measure
Description1 |ỹt − yt |T t=1T
Mean absolute error
MAE =
Mean absolute percentage error
MAPE =
Root-mean-squared error
Theil’s inequality coefﬁcient
T 100   ỹt − yt T t=1  yt T1 RMSE =(ỹt − yt )2T t=1T1 (ỹt − yt )2T t=1U= TT1 1 2(ỹt ) +(yt )2T t=1T t=1100 DtN t=1
(1.10)
(1.11)
(1.12)
(1.13)
N
Correct directional change
CDC =
(1.14)
where Dt = 1 if yt · ỹt > 0 else Dt = 0yt is the actual change at time t.ỹt is the forecast change.t = 1 to t = T for the forecast period.
risk-adjusted measure of return, with higher ratios preferred to those that are lower, themaximum drawdown is a measure of downside risk and the average gain/loss ratio isa measure of overall gain, a value above one being preferred (Dunis and Jalilov, 2002;Fernandez-Rodriguez et al., 2000).The application of these measures may be a better standard for determining the qualityof the forecasts. After all, the ﬁnancial gain from a given strategy depends on tradingperformance, not on forecast accuracy.1.6.3 Out-of-sample forecasting accuracy resultsThe forecasting accuracy statistics do not provide very conclusive results. Each of themodels evaluated, except the logit model, are nominated “best” at least once. Interestingly,the naı̈ve model has the lowest Theil-U statistic at 0.6901; if this model is believed to bethe “best” model there is likely to be no added value using more complicated forecastingtechniques. The ARMA model has the lowest MAPE statistic at 101.51%, and equalsthe MAE of the NNR model at 0.0056. The NNR model has the lowest RMSE statistic,however the value is only marginally less than the ARMA model. The MACD model hasthe highest CDC measure, predicting daily changes accurately 60.00% of the time. It isdifﬁcult to select a “best” performer from these results, however a majority decision rule
Applications of Advanced Regression AnalysisTable 1.17
33
Trading simulation performance measures
Performance measure
Description1 RtN t=1N
Annualised return
R A = 252 ×
Cumulative return
RC =
Annualised volatility
Sharpe ratioMaximum daily proﬁtMaximum daily lossMaximum drawdown
σA =
√
252 ×
N
RT
(1.16)
t=1N1 (Rt − R)2N − 1 t=1
RAσAMaximum value of Rt over the periodMinimum value of Rt over the periodMaximum negative value of(RT ) over the periodMD = min Rtc − max RicSR =
t=1,...,N
i=1,...,t
N
% Winning trades
(1.15)
WT = 100 ×
(1.17)
(1.18)(1.19)(1.20)
(1.21)
Ft
t=1
(1.22)
NT
where Ft = 1 if transaction proﬁtt > 0NGt% Losing tradesNumber of up periodsNumber of down periodsNumber of transactions
LT = 100 ×
t=1
NTwhere Gt = 1 if transaction proﬁtt < 0Nup = number of Rt > 0Ndown = number of Rt < 0NLtNT =
(1.23)(1.24)(1.25)(1.26)
t=1
Total trading daysAvg. gain in up periodsAvg. loss in down periodsAvg. gain/loss ratio
Probability of 10% loss
where Lt = 1 if trading signalt = trading signalt−1Number of all Rt ’sAG = (Sum of all Rt > 0)/NupAL = (Sum of all Rt < 0)/NdownGL = AG/AL MaxRisk(1 − P )P oL =P(W T × AG) + (LT × AL)where P = 0.5 × 1 + [(W T × AG2 ) + (LT × AL2 )]and  = [(W T × AG2 ) + (LT × AL2 )]
(1.27)(1.28)(1.29)(1.30)
(1.31)
MaxRisk is the risk level deﬁned by the user; this research, 10%Proﬁts T -statisticsSource: Dunis and Jalilov (2002).
T -statistics =
√
N×
RAσA
(1.32)
34
Applied Quantitative Methods for Trading and InvestmentTable 1.18
Trading simulation performance measures
Performance measure
DescriptionNPR =
Number of periods dailyreturns rise
N
Qt
(1.33)
t=1
where Qt = 1 if yt > 0 else Qt = 0N
Number of periods dailyreturns fall
NPF =
Number of winning upperiods
NWU =
St
(1.34)
t=1
where St = 1 if yt < 0 else St = 0N
Bt
(1.35)
t=1
where Bt = 1 if Rt > 0 and yt > 0 else Bt = 0NWD =
Number of winning downperiods
N
Et
(1.36)
t=1
where Et = 1 if Rt > 0 and yt < 0 else Et = 0WUP = 100 × (NWU/NPR)WDP = 100 × (NWD/NPF)
Winning up periods (%)Winning down periods (%)
(1.37)(1.38)
Table 1.19 Forecasting accuracy results21
Mean absolute errorMean absolute percentage errorRoot-mean-squared errorTheil’s inequality coefﬁcientCorrect directional change
Naı̈ve
MACD
ARMA
Logit
NNR
0.0080317.31%0.01020.690155.86%
––––60.00%
0.0056101.51%0.00740.904556.55%
––––53.79%
0.0056107.38%0.00730.878857.24%
might select the NNR model as the overall “best” model because it is nominated “best”twice and also “second best” by the other three statistics. A comparison of the forecastingaccuracy results is presented in Table 1.19.1.6.4 Out-of-sample trading performance resultsA comparison of the trading performance results is presented in Table 1.20 andFigure 1.18. The results of the NNR model are quite impressive. It generally outperformsthe benchmark strategies, both in terms of overall proﬁtability with an annualised returnof 29.68% and a cumulative return of 34.16%, and in terms of risk-adjusted performancewith a Sharpe ratio of 2.57. The logit model has the lowest downside risk as measuredby maximum drawdown at −5.79%, and the MACD model has the lowest downside risk21As the MACD model is not based on forecasting the next period and binary variables are used in the logitmodel, statistical accuracy comparisons with these models were not always possible.
Applications of Advanced Regression AnalysisTable 1.20
35
Trading performance resultsMACD
ARMA
Logit
NNR
Annualised returnCumulative returnAnnualised volatilitySharpe ratioMaximum daily proﬁtMaximum daily lossMaximum drawdown% Winning trades% Losing tradesNumber of up periodsNumber of down periodsNumber of transactionsTotal trading daysAvg. gain in up periodsAvg. loss in down periodsAvg. gain/loss ratioProbability of 10% lossProﬁts T -statistics
21.34%24.56%11.64%1.833.38%−2.10%−9.06%37.01%62.99%1621261272900.58%−0.56%1.050.70%31.23
11.34%13.05%11.69%0.971.84%−3.23%−7.75%24.00%76.00%149138252900.60%−0.55%1.080.02%16.51
12.91%14.85%11.69%1.103.38%−2.10%−10.10%52.71%47.29%1641241292900.55%−0.61%0.915.70%18.81
21.05%24.22%11.64%1.811.88%−3.38%−5.79%49.65%50.35%1561321412900.61%−0.53%1.140.76%30.79
29.68%34.16%11.56%2.573.38%−1.82%−9.12%52.94%47.06%1661221362900.60%−0.54%1.120.09%43.71
Number of periods daily returns riseNumber of periods daily returns fallNumber of winning up periodsNumber of winning down periods% Winning up periods% Winning down periods
128162659750.78%59.88%
1281624510435.16%64.20%
1281625610843.75%66.67%
1281624910638.28%66.05%
1281625211440.63%70.37%
Cumulated profit
Naı̈ve
40%35%30%25%20%15%10%5%0%−5%−10%19/05/00 19/08/00 19/11/00 19/02/01 19/05/0119 May 2000 to 3 July 2001
NaïveMACDARMAlogitNNR
Figure 1.18 Cumulated proﬁt graph
as measured by the probability of a 10% loss at 0.02%, however this is only marginallyless than the NNR model at 0.09%.The NNR model predicted the highest number of winning down periods at 114, whilethe naı̈ve model forecast the highest number of winning up periods at 65. Interestingly,all models were more successful at forecasting a fall in the EUR/USD returns series, asindicated by a greater percentage of winning down periods to winning up periods.
36
Applied Quantitative Methods for Trading and Investment
The logit model has the highest number of transactions at 141, while the NNR modelhas the second highest at 136. The MACD strategy has the lowest number of transactionsat 25. In essence, the MACD strategy has longer “holding” periods compared to theother models, suggesting that the MACD strategy is not compared “like with like” to theother models.More than with statistical performance measures, ﬁnancial criteria clearly single out theNNR model as the one with the most consistent performance. Therefore it is consideredthe “best” model for this particular application.1.6.5 Transaction costsSo far, our results have been presented without accounting for transaction costs during thetrading simulation. However, it is not realistic to account for the success or otherwise ofa trading system unless transaction costs are taken into account. Between market makers,a cost of 3 pips (0.0003 EUR/USD) per trade (one way) for a tradable amount, typicallyUSD 5–10 million, would be normal. The procedure to approximate the transaction costsfor the NNR model is quite simple.A cost of 3 pips per trade and an average out-of-sample EUR/USD of 0.8971 producean average cost of 0.033% per trade:0.0003= 0.033%0.8971The NNR model made 136 transactions. Since the EUR/USD time series is a series ofbid rates and because, apart from the ﬁrst trade, each signal implies two transactions, oneto close the existing position and a second one to enter the new position indicated by themodel signal, the approximate out-of-sample transaction costs for the NNR model tradingstrategy are about 4.55%:136 × 0.033% = 4.55%Therefore, even accounting for transaction costs, the extra returns achieved with theNNR model still make this strategy the most attractive one despite its relatively hightrading frequency.
1.7 CONCLUDING REMARKSThis chapter has evaluated the use of different regression models in forecasting and tradingthe EUR/USD exchange rate. The performance was measured statistically and ﬁnanciallyvia a trading simulation taking into account the impact of transaction costs on modelswith higher trading frequencies. The logic behind the trading simulation is, if proﬁt froma trading simulation is compared solely on the basis of statistical measures, the optimummodel from a ﬁnancial perspective would rarely be chosen.The NNR model was benchmarked against more traditional regression-based and otherbenchmark forecasting techniques to determine any added value to the forecasting process.Having constructed a synthetic EUR/USD series for the period up to 4 January 1999, themodels were developed using the same in-sample data, 17 October 1994 to 18 May 2000,leaving the remaining period, 19 May 2000 to 3 July 2001, for out-of-sample forecasting.
Applications of Advanced Regression Analysis
37
Forecasting techniques rely on the weaknesses of the efﬁcient market hypothesis,acknowledging the existence of market inefﬁciencies, with markets displaying even weaksigns of predictability. However, FX markets are relatively efﬁcient, reducing the scope ofa proﬁtable strategy. Consequently, the FX managed futures industry average Sharpe ratiois only 0.8, although a percentage of winning trades greater than 60% is often requiredto run a proﬁtable FX trading desk (Grabbe, 1996 as cited in Bellgard and Goldschmidt,1999: 10). In this respect, it is worth noting that only one of our models reached a 60%winning trades accuracy, namely the MACD model at 60.00%. Nevertheless, all of themodels examined in this chapter achieved an out-of-sample Sharpe ratio higher than 0.8,the highest of which was again the NNR model at 2.57. This seems to conﬁrm that theuse of quantitative trading is more appropriate in a fund management than in a treasurytype of context.Forecasting techniques are dependent on the quality and nature of the data used. If thesolution to a problem is not within the data, then no technique can extract it. In addition,sufﬁcient information should be contained within the in-sample period to be representativeof all cases within the out-of-sample period. For example, a downward trending seriestypically has more falls represented in the data than rises. The EUR/USD is such a serieswithin the in-sample period. Consequently, the forecasting techniques used are estimatedusing more negative values than positive values. The probable implication is that themodels are more likely to successfully forecast a fall in the EUR/USD, as indicated byour results, with all models forecasting a higher percentage of winning down periods thanwinning up periods. However, the naı̈ve model does not learn to generalise per se, andas a result has the smallest difference between the number of winning up to winningdown periods.Overall our results conﬁrm the credibility and potential of regression models and particularly NNR models as a forecasting technique. However, while NNR models offer apromising alternative to more traditional techniques, they suffer from a number of limitations. They are not the panacea. One of the major disadvantages is the inability to explaintheir reasoning, which has led some to consider that “neural nets are truly black boxes.Once you have trained a neural net and are generating predictions, you still do not knowwhy the decisions are being made and can’t ﬁnd out by just looking at the net. It is notunlike attempting to capture the structure of knowledge by dissecting the human brain”(Fishman et al., 1991 as cited in El-Shazly and El-Shazly, 1997: 355). In essence, the neural network learning procedure is not very transparent, requiring a lot of understanding.In addition, statistical inference techniques such as signiﬁcance testing cannot always beapplied, resulting in a reliance on a heuristic approach. The complexity of NNR modelssuggests that they are capable of superior forecasts, as shown in this chapter, howeverthis is not always the case. They are essentially nonlinear techniques and may be less capable in linear applications than traditional forecasting techniques (Balkin and Ord, 2000;Campbell et al., 1997; Lisboa and Vellido, 2000; Refenes and Zaidi, 1993).Although the results support the success of neural network models in ﬁnancial applications, there is room for increased success. Such a possibility lies with optimising theneural network model on a ﬁnancial criterion, and not a mathematical criterion. As theproﬁtability of a trading strategy relies on correctly forecasting the direction of change,namely CDC, to optimise the neural network model on such a measure could improvetrading performance. However, backpropagation networks optimise by minimising a differentiable function such as squared error, they cannot minimise a function based on loss,
38
Applied Quantitative Methods for Trading and Investment
or conversely, maximise a function based on proﬁt. Notwithstanding, there is possibilityto explore this idea further, provided the neural network software has the ability to selectsuch an optimisation criterion.Future work might also include the addition of hourly data as a possible explanatoryvariable. Alternatively, the use of ﬁrst differences instead of rates of return series may beinvestigated, as ﬁrst differences are perhaps the most effective way to generate data setsfor neural network learning (Mehta, 1995).Further investigation into RNN models is possible, or into combining forecasts. Manyresearchers agree that individual forecasting methods are misspeciﬁed in some manner,suggesting that combining multiple forecasts leads to increased forecast accuracy (Dunisand Huang, 2002). However, initial investigations proved unsuccessful, with the NNRmodel remaining the “best” model. Two simple model combinations were examined,a simple averaging of the naı̈ve, ARMA and NNR model forecasts, and a regressiontype combined forecast using the naı̈ve, ARMA and NNR models.22 The regressiontype combined forecast follows the Granger and Ramanathan procedure (gr.wf1 EViewsworkﬁle). The evaluation can be reviewed in Sheet 2 of the oos gr.xls Excel spreadsheet,and is also presented in Figure 1.19. The lack of success using the combination modelswas undoubtedly because the performance of the benchmark models was so much weakerthan that of the NNR model. It is unlikely that combining relatively “poor” models withan otherwise “good” one will outperform the “good” model alone.The main conclusion that can be drawn from this chapter is that there are indeednonlinearities present within ﬁnancial markets and that a neural network model can be
Figure 1.19 Regression-type combined forecast Excel spreadsheet (out-of-sample)22For a full discussion on the procedures, refer to Clemen (1989), Granger and Ramanathan (1984), and Hashem(1997).
Applications of Advanced Regression Analysis
39
trained to recognise them. However, despite the limitations and potential improvementsmentioned above, our results strongly suggest that regression models and particularlyNNR models can add value to the forecasting process. For the EUR/USD exchange rateand the period considered, NNR models clearly outperform the more traditional modellingtechniques analysed in this chapter.
REFERENCESBalkin, S. D. and J. K. Ord (2000), “Automatic Neural Network Modelling for Univariate TimeSeries”, International Journal of Forecasting, 16, 509–515.Bellgard, C. and P. Goldschmidt (1999), “Forecasting Across Frequencies: Linearity and NonLinearity”, University of Western Australia Research Paper, Proceedings of the InternationalConference on Advanced Technology, Australia, (www.imm.ecel.uwa.edu.au/∼cbellgar/).Box, G. E. P., G. M. Jenkins and G. C. Reinsel (1994), Time Series Analysis: Forecasting andControl, Prentice Hall, Englewood Cliffs, NJ.Campbell, I. Y., A. W. Lo and A. C. MacKinley (1997), “Nonlinearities in Financial Data”, in TheEconometrics of Financial Markets, Princeton University Press, Princeton, NJ, pp. 512–524.Carney, J. C. and P. Cunningham (1996), “Neural Networks and Currency ExchangeRate Prediction”, Trinity College Working Paper, Foresight Business Journal web page,(www.maths.tcd.ie/pub/fbj/forex4.html).Clemen, R. T. (1989), “Combining Forecasts: A Review and Annotated Bibliography”, International Journal of Forecasting, 5, 559–583.Diekmann, A. and S. Gutjahr (1998), “Prediction of the Euro–Dollar Future Using Neural Networks – A Case Study for Financial Time Series Prediction”, University of Karlsruhe WorkingPaper, Proceedings of the International Symposium on Intelligent Data Engineering and Learning(IDEAL’98), Hong Kong, (http://citeseer.nj.nec.com/diekmann98prediction.html).Dunis, C. and X. Huang (2002), “Forecasting and Trading Currency Volatility: An Application ofRecurrent Neural Regression and Model Combination”, The Journal of Forecasting, 21, 317–354.Dunis, C. and J. Jalilov (2002), “Neural Network Regression and Alternative Forecasting Techniques for Predicting Financial Variables”, Neural Network World, 2, 113–139.El-Shazly, M. R. and H. E. El-Shazly (1997), “Comparing the Forecasting Performance of NeuralNetworks and Forward Exchange Rates”, Journal of Multinational Financial Management, 7,345–356.Fernandez-Rodriguez, F., C. Gonzalez-Martel and S. Sosvilla-Rivero (2000), “On the Proﬁtabilityof Technical Trading Rules Based on Artiﬁcial Neural Networks: Evidence from the MadridStock Market”, Economics Letters, 69, 89–94.Fishman, M. B., D. S. Barr and W. J. Loick (1991), “Using Neural Nets in Market Analysis”,Technical Analysis of Stocks and Commodities, 9, 4, 135–138.Gençay, R. (1999), “Linear, Non-linear and Essential Foreign Exchange Rate Prediction with SimpleTechnical Trading Rules”, Journal of International Economics, 47, 91–107.Gouriéroux, C. and A. Monfort (1995), Time Series and Dynamic Models, translated and edited byG. Gallo, Cambridge University Press, Cambridge.Grabbe, J. O. (1996), International Financial Markets, 3rd edition, Prentice Hall, Englewood Cliffs,NJ.Granger, C. W. J. and R. Ramanathan (1984), “Improved Methods of Combining Forecasts”, Journal of Forecasting, 3, 197–204.Hanke, J. E. and A. G. Reitsch (1998), Business Forecasting, 6th edition, Prentice Hall, EnglewoodCliffs, NJ.Hashem, S. (1997), “Optimal Linear Combinations of Neural Networks”, Neural Networks, 10, 4,599–614 (www.emsl.pnl.gov:2080/people/bionames/hashem s.html).Haykin, S. (1999), Neural Networks: A Comprehensive Foundation, 2nd edition, Prentice Hall,Englewood Cliffs, NJ.Hornik, K., M. Stinchcombe and H. White (1989), “Multilayer Feedforward Networks Are Universal Approximators”, Neural Networks, 2, 359–366.Kaastra, I. and M. Boyd (1996), “Designing a Neural Network for Forecasting Financial andEconomic Time Series”, Neurocomputing, 10, 215–236.
40
Applied Quantitative Methods for Trading and Investment
Kingdon, J. (1997), Intelligent Systems and Financial Forecasting, Springer, London.Lisboa, P. J. G. and A. Vellido (2000), “Business Applications of Neural Networks”, inP. J. G. Lisboa, B. Edisbury and A. Vellido (eds), Business Applications of Neural Networks:The State-of-the-Art of Real-World Applications, World Scientiﬁc, Singapore, pp. vii–xxii.Maddala, G. S. (2001), Introduction to Econometrics, 3rd edition, Prentice Hall, Englewood Cliffs,NJ.Mehta, M. (1995), “Foreign Exchange Markets”, in A. N. Refenes (ed.), Neural Networks in theCapital Markets, John Wiley, Chichester, pp. 176–198.Pesaran, M. H. and B. Pesaran (1997), “Lessons in Logit and Probit Estimation”, in InteractiveEconometric Analysis Working with Microﬁt 4, Oxford University Press, Oxford, pp. 263–275.Pindyck, R. S. and D. L. Rubinfeld (1998), Econometric Models and Economic Forecasts, 4th edition, McGraw-Hill, New York.Previa (2001), Previa Version 1.5 User’s Guide, (www.elseware.fr/previa).Refenes, A. N. and A. Zaidi (1993), “Managing Exchange Rate Prediction Strategies with NeuralNetworks”, in P. J. G. Lisboa and M. J. Taylor (eds), Techniques and Applications of NeuralNetworks, Ellis Horwood, Hemel Hempstead, pp. 109–116.Shapiro, A. F. (2000), “A Hitchhiker’s Guide to the Techniques of Adaptive Nonlinear Models”,Insurance, Mathematics and Economics, 26, 119–132.Thomas, R. L. (1997), Modern Econometrics. An Introduction, Addison-Wesley, Harlow.Tyree, E. W. and J. A. Long (1995), “Forecasting Currency Exchange Rates: NeuralNetworks and the Random Walk Model”, City University Working Paper, Proceedingsof the Third International Conference on Artiﬁcial Intelligence Applications, New York,(http://citeseer.nj.nec.com/131893.html).Yao, J., H. Poh and T. Jasic (1996), “Foreign Exchange Rates Forecasting with Neural Networks”,National University of Singapore Working Paper, Proceedings of the International Conference onNeural Information Processing, Hong Kong, (http://citeseer.nj.com/yao96foreign.html).Yao, J., Y. Li and C. L. Tan (1997), “Forecasting the Exchange Rates of CHF vs USD Using NeuralNetworks”, Journal of Computational Intelligence in Finance, 15, 2, 7–13.Zhang, G., B. E. Patuwo and M. Y. Hu (1998), “Forecasting with Artiﬁcial Neural Networks: TheState of The Art”, International Journal of Forecasting, 14, 35–62.
2
Using Cointegration to Hedge and TradeInternational EquitiesA. NEIL BURGESS
ABSTRACTIn this chapter, we examine the application of the econometric concept of cointegrationas a tool for hedging and trading international equities. The concepts are illustrated withrespect to a particular set of data, namely the 50 equities which constituted the STOXX50 index as of 4 July 2002. The daily closing prices of these equities are investigatedover a period from 14 September 1998 to 3 July 2002 – the longest period over whichcontinuous data is available across the whole set of stocks in this particular universe. Theuse of daily closing prices will introduce some spurious effects due to the non-synchronousclosing times of the markets on which these equities trade. In spite of this, however, thedata are deemed suitable for the purposes of illustrating the tools in question and also ofindicating the potential beneﬁts to be gained from intelligent application of these tools.We consider cointegration as a framework for modelling the inter-relationships betweenequities prices, in a manner which can be seen as a sophisticated form of “relative value”analysis. Depending on the particular task in hand, cointegration techniques can be usedto identify potential hedges for a given equity position and/or to identify potential tradeswhich might be taken from a statistical arbitrage perspective.
2.1 INTRODUCTIONIn this section we describe the econometric concept of “cointegration”, and explain ourmotivation for developing trading tools based upon a cointegration perspective.Cointegration is essentially an econometric tool for identifying situations where stablerelationships exist between a set of time series. In econometrics, cointegration testing istypically seen as an end in itself, with the objective of testing an economic hypothesisregarding the presence of an equilibrium relationship between a set of economic variables.A possible second stage of cointegration modelling is to estimate the dynamics of themechanism by which short-term deviations from the equilibrium are corrected, i.e. toconstruct an error-correction model (ECM).The 