Forecasting Foreign Exchange Rates Using NN and R.W
Forecasting Foreign Exchange Rates Using NN and R.W
∑ (A
y(t + 1) with a neural network was examined. The
E = 0.5 p − Dp )2
training data used consisted of the first 850 trading
p =1
days of the exchange rate data and the test data
where A is the network output for output pattern p, D
consisted of the following 50 days. Various sizes of
is the desired output for pattern p and N is the number
Wi were tried, ranging from 2 to 20 trading days, of
of patterns. The results of the neural network model
which none provided satisfactory results. Increasing
were then analysed with respect to random walk
the number of hidden units did not produce any
forecasting model. The random walk forecasting
improvement either.
model was defined as today's price being the best
forecast for any point in the future. More formally, y(t
The results are shown in fig. 1 which compares the
+ N) = y(t - 1) + ε (t) where y(t + N) is any point in
results from the random walk model, an
the future and ε (t) is an error term2. The relative
autoregressive model, a multilayer perceptron with 10
performances of the models used in this work was
inputs and 5 hidden units and a single layer
analysed by comparing the mean squared errors of the
perceptron with 10 inputs. The network results
models over the test sets. All currency and interest rate
displayed were typical of that found in this experiment
data used was daily data from the period beginning
regardless of the hidden or input layer size. Clearly,
Jan. 1, 1990 and ending May 31, 1994.
the random walk model is producing more accurate
forecasts. An autoregressive process used to fit the
training data produced a second order linear model of
the form:
0.51
0.49 In this experiment, the random walk model is used to
0.47 fit the US$ - DM exchange rate. As mentioned before,
0.45 this model assumes that a value at a given time t + N
0.43
is equal to the value at time t plus some noise. If this is
0.41
0.39 true, then the k - day differenced US$ - DM exchange
0.37 rate series should be random noise as these values
0.35 would simply be the random series left over from
11
16
21
26
31
36
41
46
1
6
0.55 Two tests for randomness were run to test the fit of
US$/DM (normalized)
T IME (days )
value and a variance of (n + 1)/12 with the resulting
distribution tending rapidly towards normality
(Moore and Wallis (1943)). The serial correlation test
Fig. 2: Random walk (top) and neural network (bottom) simply tries to find a correlation between successive
single day forecasts. The thick lines are the actual exchange rate values. If a given series has structure beyond random
and the thin lines represent the forecasts.
fluctuations, there will be some degree of correlation
between one value and the next (Kendall and Stuart Looking first at the difference-sign test, the top part of
(1968)). table gives the expected number of turning points and
the expected standard deviation for each lag time. The
next four rows give the results of the differenced and
RANDOM WALK MODEL RESIDUALS
differenced squared exchange rates along with p
Lag Times
which indicates the probability that the number of
1 Day 2 Day 3 Day 4 Day 5 Day
positive sign changes found in the exchange rate is
DIFFERENCE SIGN indicative of it being a random series using a simple z
exp p. d. 575.0 288.0 192.0 144.0 115.0 test.
exp s.d. 9.80 6.94 5.67 4.92 4.40
In short, these results are quite marginal except in two
diff 559, 278, 185, 144, 116, cases. A 1 day lag it can be said with greater than 95%
p= 0.10 0.15 0.22 1.0 0.82
diff sq. 544, 298, 194, 141, 117, certainty (p = 0.002) that the difference squared series
p= 0.002 0.15 0.73 0.54 8.82 in not random. Conversely, at 4 days it can be said
SERIAL CORRELATION that the differenced series is random with greater than
diff 0.030 0.005 -0.036 -0.049 -0.056
95% certainty (p = 1.0). The rest of the results fail the
diff sq. 0.063 0.112 0.208 -0.005 0.183 95% percent certainty criteria for either accepting or
±sig @
0.059 0.083 0.102 0.118 0.132
rejecting that the exchange rate is random. In these
0.95%
3
cases the probability that the number of positive
Table 1: Random walk model residuals. changes observed indicate that the exchange rate is
random ranged from 0.10% (p = 0.1) and 82% (p =
In this experiment the entire data set used in this work 0.82). A less stringent criteria for accepting the
was run through these tests at time lags of 1, 2, 3, 4, hypothesis that the changes in the US$ - DM are
and 5 days. In other words, the adequacy of the random could be adopted in which any number of
random walk model is being tested for the changes in positive changes found within one standard deviation
the US$ - DM exchange rate for periods of 1 to 5 (i.e. p <= 68%) of the expected number of positive
days. It should be noted that when testing at time lags changes would be accepted as indicative of
greater than 1 day the series must be differenced such randomness. In this case, the results are still mixed
that dn = ytk - y(t - 1)k where d is the differenced value with the differences series indicating non randomness
and k is the lag. The reason for this is that if one were at lags of 1 (p = 0.01), 2 (p = 0.15) and 3 (p = 0.22)
to simply difference every value in the series from the and the differenced squared series indicating non
value k time steps in the past, one would artificially randomness at lags of 1 (p = 0.002), 2 (p = 0.15) and 4
induce correlation in the series that did not initially (p = 0.54).
exist as the various values resulting from the
subtraction process would contain common terms. The serial correlation test resulted in slightly more
Therefore, a series of N values will produce a consistent results. For the differenced series, all five
differenced series of size N/k. For this reason, only time lags indicated randomness p >= 95% while the
lags of up to 5 days were tested for the random walk differenced squared series indicated significant non
model as lags of more than 5 would produce too small randomness at 95% certainty at all lags except 4.
of samples. The results are displayed in table 1.
As much as these results are mixed, they do seem to
3This is the probability that the correlation found is significantly indicate that the US$ - DM exchange rate is not
different from 0 using the general heuristic of 2/ N to determine strictly random. In other words, there is some structure
95% certainty (Chatfield, (1975)). to be found in the 1 - 5 day price changes albeit small
and probably very subtle. The random walk model demonstrated that there may be some subltle structure
can probably be rejected as the most appropriate in the US$ - DM exchange rate, this next experiment
model explaining the changes in the US$ - DM attempted to use a network to find a relationship
exchange rate. Nonetheless, because the structure that between a segment of the time series consisting of
exists in the changes is so small (and possibly data up to and including the rate at time t and the
complex) forecasting these changes will most value of the exchange rate at time t + 5 and t + 20 that
probably be anything but trivial. can be used for a forecast.
0.75
in the previous input although what exactly the
0.7 networks are modelling in the data is unclear. All that
0.65 can be said, though, is that the initial "positive" results
0.6 in fig. 6 were probably spurious. It should also be
0.55
0.5 noted that a similar result was found on the 20 day
0.45 forecasting where a single positive result could not be
0.4 replicated on other parts of the data set. Nonetheless,
0.35
100 these results underscore the need for more care to be
1
10
19
28
37
46
55
64
73
82
91
0.85 0.55
0.53
US$/DM (normalized)
0.75
0.51
0.65 0.49
0.55 0.47
0.45
0.45 0.43
0.41
0.35
0.39
1
9
17
25
33
41
49
57
65
73
81
89
97
0.37
T IME (days ) 0.35
1
5
9
13
17
21
25
29
33
37
41
45
49
T IME (days )
Fig. 5: 20 day random walk forecast and the univariate 20 day Fig. 6: Multistep forecast using first 850 days as training.
forecast.
Multis tep forecas t for data s et B
0.5
An attempt was also made to look at the multistep 0.45
predictive abilities of the networks used in experiment
0.4
1. Initially the results looked surprisingly promising
given the previous results. Fig. 6 shows the results of 0.35
the single day multistep forecast made over the same 0.3
part of the data set as was used before. The network
0.25
does seem to have forecast three of the major turning
1
5
9
13
17
21
25
29
33
37
41
45
49
UD$/DM (normalized)
0.8
0.7
For the single day forecasts the networks were given 0.6
10 days of each of the above variables. Thus the 0.5
networks had a total of 130 input units with the 0.4
hidden units being varied from 0 to 30. The networks 0.3
were trained on the first 850 days of the data set and 0.2
1
8
15
22
29
36
43
50
57
64
71
78
85
92
99
tested on the following 100. The results of the single
T IME (days )
day multivariate forecasts with a 5 hidden unit
network are displayed in fig. 8. Actual US $/DM F orecas t
0.8
0.7 The best performance was found with the 20 hidden
0.6 unit MLP although none of the networks used were
0.5 able to outperform the random walk model in terms of
0.4 mean squared error. Nonetheless, the network is not
0.3
strictly outputting previous input and in fact does to
1
8
15
22
29
36
43
50
57
64
71
78
85
92
99
DISCUSSION
Fig:8: Multivariate single day forecast.
Although the US$ - DM price changes where shown
The results here are similar to the univariate 1 day to be not strictly random in a statistical sense, from a
forecasts. Increasing the number of hidden units did forecasting point of view what little structure actually
not lead to improved performance. As can be seen the is present may well be too negligible to be of much
networks have not been able to outperform the use. Given the performance of the network models in
random walk model. Similar to the univariate one day univariate portion of this study, the random walk
forecasts, the networks here were very roughly model appears to be the more accurate for daily,
approximating a random walk type performance. weekly and monthly forecasting of the US$ - DM
exchange rate. Does this mean that the random walk
model is the optimal technical forecasting technique daily data. This suggests that either the results of
for the US$ - DM exchange rate? Certainly not. previous work require some reevaluation or that there
However, in forecasting the US$ - DM exchange rate is something special about the nature of hourly
using only daily US$ - DM data, the random walk changes in the US$ - DM prices changes that can be
model has been the most effective of the models exploited for forecasting that cannot be found in the
examined here at all three forecast lead times. daily changes. Second, more research could be
conducted examining the use of additional types of
This has some implications regarding the work of input and architectures in neural network based
Refenes et al (1993). Essentially, the only difference financial market forecasting systems. Finally, given
between their study of single day forecasting and the the lack of cross model comparisons in previous
univariate experiments conducted here, is that they research, more work needs to be done examining the
used hourly data. It seems reasonable to argue that if relative forecasting abilities of connectionist and more
their model was truly robust, the use of daily data standard financial modelling techniques. An
should have worked just as well. If anything, the experimental framework incorporating cross
hourly data would have been even more noisy than comparisons between different forecasting models
the daily data thus making forecasting even more combined with multiple simulation runs is
difficult. Refenes et al also looked at multistep recommended in research claiming the superiority of
forecasting which was also attempted here. The initial neural networks in financial forecasting. This will
positive results we found with multistep forecasting in ensure that the advantages of connectionist forecasting
this work turned out to be spurious. In future work, the methods cannot be simply written off as data mining.
use of hourly data will be investigated to see if the
dynamics of hourly price changes are more conducive
to univariate forecasting than daily changes. REFERENCES
The multivariate 1 day experiment was not much Binks, D. L. and Allinson, N. M. (1991) "Financial
different than the univariate single day forecasting. data recognition and prediction using neural
Why this is so is unclear but perhaps the use of networks", Artificial Neural Networks, T. Kohonen,
additional currency and interest rate data here was not K. Makisara and J. Kangas (editors), Elsevier Science
sufficient to capture the dynamics of the daily price Publishers, B.V. (North-Holland), 1709 - 12.
changes.
Chatfield, C. (1975) The analysis of time series:
The 5 day forecast were a bit more interesting if only Theory and practice, Chapman and Hall, London, pg.
because the networks did seem to pick up on some of 25.
the general trend information. Future work will
explore the use of a larger variety of input variables Collard, J. E. (1991) "A B-P commodity trader",
and network architectures. Advances in Neural Information Processing Systems
III, B. M. Spatz (editor), Morgan Kaufmann
Publishers, San Mateo, CA., 551 - 56.
CONCLUSIONS
Diebold, F. X. and Nason, J. A. (1990)
The conclusions of this work are three fold: First, "Nonparametric exchange rate prediction?", Journal
previous work claiming good forecasting performance of International Economies, 28, 315 - 32.
of the US$ - DM using univariate hourly input to
feedforward networks could not be replicated with
Hutchinson, J. M. (1994) A radial basis function
approach to financial time series, Masters Thesis,
Department of Electrical Engineering and Computer
Science, Massachusetts Institute of Technology,
Mass, USA.