Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Technical Indicators for Forex Forecasting:

A Preliminary Study

Yoke Leng Yong(), David C.L. Ngo, and Yunli Lee

Department of Computing and Information Systems,


Sunway University, Bandar Sunway, Malaysia
14071856@imail.sunway.edu.my,
{dngo,yunlil}@sunway.edu.my

Abstract. Traders and economists are often at odds with regards to the ap-
proach taken towards Forex financial market forecasting. Methods originating
from the Artificial Intelligence (AI) area of study have been used extensively
throughout the years in predicting the trading pattern as it is deemed to be ro-
bust enough to handle the uncertainty associated with Forex trading time series
data. Herein this paper, the effects of different input types, in particular: close
price as well as various technical indicators derived from the close price are in-
vestigated to determine its effects on the Forex trend predicted by an intelligent
machine learning module.

Keywords: Forex forecasting · Technical analysis · Linear regression line ·


Artificial Neural Network · Dynamic Time Warping

1 Introduction

Financial markets encompasses a huge variety of markets such as: Stock Markets,
Commodity Markets, Money Markets, Derivatives Markets, Futures Markets, Insur-
ance Markets, and Foreign Exchange Markets (Forex). However, most traders gravitate
towards the Stock Market and Foreign Exchange. With an average daily trading value
of 3.2 trillion [1], it is a fast paced and dynamic market where traders often watch
every little movement like a hawk. With the advancement of research in the application
of Artificial Intelligence in computational finance, it has been slowly been adopted in
to assist traders in making informed decisions while trading. Numerous publications
have attempted to construct an accurate model for Forex time series prediction. Most
of these works focus on time series prediction with various AI models, or some hybrid
combinations as well as statistical techniques, such as moving average. While the
introduction of AI models in Forex prediction have increased dramatically as it has
been adopted by the traders, these methods inevitably have their own limitations at
different stages of its prediction pipeline. Herein, the investigation focuses on finding
the most efficient input parameter to produce a more accurate prediction of the Forex
time series data from an intelligent machine learning module such as implemented by
Tiong, Ngo and Lee [14], [15] which will be further discussed in Section 3.

© Springer International Publishing Switzerland 2015


Y. Tan et al. (Eds.): ICSI-CCI 2015, Part III, LNCS 9142, pp. 87–97, 2015.
DOI: 10.1007/978-3-319-20469-7_11
88 Y.L. Yong et al.

2 Forex Trading

2.1 Background
Market analysis has been extremely
e crucial in the attempt to forecast the future trrad-
ing patterns to prevent losss and generate profit. However, Forex forecasting is noot a
straight forward and easy taskt to accomplish as it is constantly affected by variious
external factors such as: poolitical stability, economic events, terms of trade, econom mic
performance and etc. All the aforementioned factors contribute to establishing the
complex and volatile naturee of Forex prediction and the challenge presented has m made
it one of the hottest topics in research community. There are currently 5 major schoools
of thoughts which contribu ute to different analysis method applied to the Forex tiime
series data, namely: Random Walk Analysis, Efficient Market Hypothesis, Technnical
Analysis, Fundamental Anaalysis, and Sentiment Analysis as shown in Fig 1.

Fig. 1. Forex Analysis Methods

The Random Walk Anaalysis was popularized by the Burton Malkiel in his boook,
“A Random Walk Down Wall W Street” [2]. The theory works under the premises tthat
the Forex price is defined by b the random walk theory whereby the fluctuation of ex-
change price is random and d unpredictable given prior values. It was the same founnda-
tion on which Eugene Famaa build his theory of Efficient Market Hypothesis [3] whhich
takes a slightly different appproach states that the effect of all the known informattion
are already reflected on the price of the stocks/currency. On the contrary, technnical
analyst / chartist believe thaat the analysis of historical Forex data reveals a pattern tthat
is constantly repeating itself which can be beneficial for forecasting [4]–[6]. Funnda-
mental Analysis and Sentiment Analysis endeavors to explain the fluctuating prrice
from the angle of cause and d effect. While Fundamental Analysis views the fluctuattion
of currency price with relaation to the supply and demand of the currency due too its
popularity, social, economic and political factors; Sentiment Analysis concentratess on
the trader’s own gut feeling g or personal opinion of how the market would perform.
Technical Indicators for Forex Forecasting 89

There are currently two different approaches in performing technical analysis for
the Forex time series data, namely: soft computing and hard computing. Hard compu-
ting refers to the more traditional approach to computing which often require the ana-
lytical model to be precisely stated and extensive computation time. Soft computing
on the other hand, offers the flexibility of dealing with uncertainty and imprecisions.
Mochón, Quintana, Sáez and Isasi [7] gave a good overview on the use of soft compu-
ting techniques applied in the finance world. Along with the research conducted in the
recent years [8], [9], soft computing techniques such as machine learning, neural net-
work, evolutionary computing, and support vector machines have been gaining pop-
ularity within the Forex market research community compared to hard computing
techniques such as: MARS and CART as mentioned by Abraham [10].

2.2 Technical Analysis


While there are numerous external factors affecting the Forex trading daily which can
be classified into one of the categories in Fig 1, time series analysis has become an
important component for Technical Analysis as it provides the necessary mechanism
to analyze Forex historical data. Various researchers have performed a lot of in depth
research in the various technical indicators used by analyst. Neely and Weller pro-
vides an extremely good introduction and background on technical analysis. Taking
things a step further, technical indicator can also be gathered from the daily trading
values could reveal a lot when analyzed thoroughly.
From the analysis of historical data, traders often form their own heuristic trading
rule where a preconceived fluctuating pattern is detected. Among the well-known
technical indicators are: Moving Averages and Moving Average Convergence Diver-
gence (MACD). Recent studies such as undertaken by Canelas, Neves and Horta [11],
[12] have also started looking into other feature representation which provides a more
elegant solution whereby a more compact feature representation for prediction (SAX)
can be obtained with faster computation which is important when dealing with a huge
dataset. It has also later been expanded to include multi-dimensional information
financial time series information [13].

2.3 Technical Indicators


Dating back to the 1700s [6], technical indicators have evolved through the years. The
various technical indicators available for the analyst to use such as: Moving Averages,
Bollinger Band, Elliot Wave Analysis, and Relative Strength Index (RSI) ranges from
the simplistic to the more complicated method in analyzing the Forex time series data.
However, the question still remains on how efficient and profitable the technical indi-
cators really are. Schulmester [5] endeavors to answer this question in his paper
“Components of the Profitability of Technical Analysis”.
Moving average is one of the most often used technical indicators used by Forex
traders. It is a lagging indicator which is extremely important to confirm that a pattern
is occurring or about to occur. Among the well-known technical indicators are:
Simple Moving Average (SMA), Exponential Moving Average (EMA), and Moving
Average Convergence Divergence (MACD) where the formulae to obtain it are as
denoted below in Equation (1) – (5).
90 Y.L. Yong et al.

Referring to Equation (1) and (2), it can be observed that traders would often use
the most familiar moving average such as SMA 10, 30, 50, 100 and 200. What makes
the aforesaid value of SMA so special? As it happens, the reason the makes it a good
practice to pay attention to the movements of the SMA values mentioned as most
traders react to these SMAs. The more traders anticipating movements and bounce of
a particular SMA, it affects the trading pattern and the anticipated movement would
likely happen.

, (1)

where m denotes the time period window defined, n is the nth data of the exchange
price and Pi is the applied price (closing price).

, (2)

1 (3)

where Pi denotes the current exchange price, n is the nth data of the exchange price and
EMAn is the EMA value of the nth price index. α is the decay factor which can be calcu-
lated as: 2/(m+1) whereby m is the time period window defined.
12 26 (4)

9 (5)

3 Proposed Research
3.1 Algorithm
Utilizing the algorithm previously proposed by Tiong, Ngo and Lee [14], [15], the
effects of different input data on the prediction results generated are investigated. The
proposed prediction algorithm focuses on prediction of two of the main Forex trend
observed by traders; uptrend and downtrend as depicted in Fig 2. Going back to the
basis of technical analysis adhered to by most of the analyst, the trend patterns are
predicted to reoccur and the prediction of trend development is carried out throughout
2 main stages: Data Analysis Stage as well as the Training and Learning Stage.

(a) (b)

Fig. 2. Archetypes of Trend Patterns: (a) Uptrend; (b) Downtrend


Technical Indicators for Forex Forecasting 91

In order to obtain the clustering results, the input data provided will have to go
through the process of feature selection, pattern analysis and segmentation as shown
in Fig 3. As the input data used is essentially a streaming input of Forex time series
data, it needs to be pre-processed and analyzed in detail. The raw Forex time series
data are segmented with the aid of Linear regression Line (LRL) prior to feature
extraction. The features that have been selected to represent the pattern trends for
clustering are as listed in Table 1. Further illustration of the feature point (A - E)
noted in Table 1 with reference to its precise location in the graph is depicted in Fig 4.
With the features selected, Linear Regression Line (LRL) will be employed to identi-
fy the trend of the input data. After the segmentation has been performed on the data,
K-means clustering is used to cluster the data.

Fig. 3. Data Analysis Stage from [14]

Fig. 4. Feature Selection Description

Table 1. Feature Selection


Feature Description Feature Point
FEATURE 1 Distance between starting point and first turning point A–B

FEATURE 2 Distance between first turning point and changing point B–C

Area under curve between


FEATURE 3 The area between starting point and changing point
A–C
FEATURE 4 Distance between changing point and second turning point C–D

FEATURE 5 Distance between second turning point and ending point D–E

Area under curve between


FEATURE 6 The area between changing point and end point
C–E
92 Y.L. Yong et al.

AI algorithms have always played a crucial role with the research focusing on
the prediction of financial market. In depth studies have been conducted into the im-
plementation of Artificial Neural Network in forecasting the Forex market trend
[16]–[20]. As previous research proved to produce reasonable results, ANN has been
implemented to train and learn data and DTW to predict data with the algorithm as
shown in Fig 5. More specifically, the Multilayer Perceptron Neural Network has been
utilized in the training and learning the patterns obtained from the previous stage.

Fig. 5. Training and Learning Stage from [14]

3.2 Dataset
In order to investigate the effects of the different input data on the prediction model,
different data inputs were tested on the system. The dataset used are the historical
data downloaded from HistData website [21] for EUR/USD and AUD/USD. The
time period chosen for testing purposes are from: 2 Jan 2012 to 29 June 2012. As the
downloaded dataset is in minutes, it is pre-processed to have the time interval of 30
minutes. The original research involves using the raw close price as input. Herein,
the performance is compared against the input of SMA10, SMA30, SMA50,
SMA100, EMA10, EMA30, EMA50 and EMA100. The full description of the data
used for testing are summarized as shown in Table 2. The full dataset are the segre-
gated in the ratio of 7:3 where 70% of the data are used for training and 30% are
used for testing.
Technical Indicators for Forex Forecasting 93

Table 2. Dataset Details

Currency dataset EUR/USD and AUD/USD data (Date/Time, open, high low and close)

Total Time Frame 2 Jan 2012 to 29 Jun 2012

Training 2 Jan 2012 to 4 May 2012

Testing 6 May 2012 to 29 Jun 2012

4 Results

The Forex trend predicted by the DTW algorithm as previously discussed in Section
3.1 provides us with a new time series to be compared against the original segmented
Forex time series data. Table 3 clearly shows an example of comparison between the
two different time series for 5 segments. The data exhibited in Table 3 is derived from
AUD/USD original time series data where the actual/original data (indicated by the
dashed line) can be seen to be compared against the partial (indicated by the solid
line) and predicted data (indicated by the dotted line). As the results obtained are in
the form of time series data, the Mean Absolute Error (MAE) measurement have been
chosen in the analyses of the prediction results obtained. Table 4 below denotes the
MAE results gathered for both the AUD/USD and EUR/USD currency. It can be ob-
served that using the close price alone produces results with the highest MAE com-
pared to SMA10, SMA30, SMA 50, SMA100, EMA10, EMA30, EMA50 and
EMA100.

Table 3. Comparison of the original and forecasted time series

Segment 1
94 Y.L. Yong et al.

Table 3. (Continued)

Segment 2

Segment 3

Segment 4
Technical Indicators for Forex Forecasting 95

Table 3. (Continued)

Segment 5

Comparing both the moving averages, it can be observed that while the faster mov-
ing average allows for faster response to the Forex price fluctuation, it is ultimately
the slower moving average which encapsulates more data and normalizes noises more
effectively and produces a smaller MAE result up to a certain extend. This is due to
the fact that the data are more intensively normalized with the slow moving average
and therefore affects the prediction result as can be seen from Table 3.
Table 4. MAE Result for Currency AUD/USD and EUR/USD
Dataset
Currency Close
SMA 10 SMA 30 SMA 50 SMA 100 EMA 10 EMA 30 EMA 50 EMA 100
Price
AUD/USD 0.1073 0.0484 0.0336 0.0217 0.0367 0.0538 0.0360 0.0360 0.0363

EUR/USD 0.0953 0.0617 0.0390 0.0337 0.0295 0.0603 0.0341 0.0413 0.0361

Investigations on the effects of the different patterns extracted for classification


have also been carried out. This is due to the fact that depending on the Forex price
fluctuation, the patterns observed during the time frame used for prediction might
contain a combination of uptrends and downtrend patterns or even none at all if the
market is slow moving. While the K- Means classifier employed in clustering have
shown great versatility, partial patterns proves to be a challenge to be classified as
there are not enough data provided when the partial pattern provided is less than 1/3
of the trend as seen in Table 4.
Table 5. K- Means classification Results
Length of partial pattern used Percentage of correctly classified partial pattern
1/2 100%
1/3 100%
1/4 49.75%
96 Y.L. Yong et al.

5 Conclusion

In conclusion, the type of input data used for Forex price forecasting is a crucial com-
ponent which cannot be taken lightly. Our experiments have proven that technical
indicators as implemented by most technical analyst can and should be incorporated
more in the research of Forex price forecasting. This signifies that by incorporating
more of the trading rules and fundamental technical analysis as performed by the tech-
nical analyst in the initial stage of the forecasting algorithm will contribute in increas-
ing the accuracy of the Forex price prediction. Further research looking into the fusion
of different technical indicators is also a possibility that could be carried out.

References
1. Dunis, C.L., Laws, J., Schilling, U.: Currency trading in volatile markets: Did neural
networks outperform for the EUR/USD during the financial crisis 2007–2009? J. Deriv.
Hedge Funds. 18(1), 2–41 (2012)
2. Malkiel, B.: A Random Walk Down Wall Street. W.W. Norton & Company Inc., New York
(1973)
3. Fama, E.F.: Efficient Capital Markets: A Review of Theory and Empirical Work. J.
Finance. 25(2), 383–417 (1970)
4. Abdullah, M.H.L.B., Ganapathy, V.: Neural network ensemble for financial trend
prediction. In: TENCON 2000, pp. 157–161 (2000)
5. Schulmeister, S.: Components of the Profitability of Technical Currency Trading. Appl.
Financ. Econ. 18(11), 917–930 (2008)
6. Neely, C.J., Weller, P.A.: Technical Analysis in the Foreign Exchange Market. Federal
Reserve Bank of St. Louis Working Paper Series 2011-001 (2011)
7. Mochón, A., Quintana, D., Sáez, Y., Isasi, P.: Soft Computing Techniques Applied to
Finance. Appl. Intell. 29(2), 111–115 (2008)
8. Vanstone, B., Tan, C.: A Survey of the Application of Soft Computing to Investment and
Financial Trading. Inf. Technol. Pap. 13 (2003)
9. De Brito, R.F.B., Oliveira, A.L.I.: Sliding window-based analysis of multiple foreign
exchange trading systems by using soft computing techniques. In: IEEE International Joint
Conference on Neural Networks (IJCNN), pp. 4251–4258 (2014)
10. Abraham, A.: Analysis of hybrid soft and hard computing techniques for forex monitoring
systems. In: Proceedings of the 2002 IEEE International Conference on Fuzzy Systems,
pp. 1616–1622 (2002)
11. Canelas, A., Neves, R., Horta, N.: A new SAX-GA methodology applied to investment
strategies optimization. In: Proceedings of The Fourteenth International Conference on
Genetic And Evolutionary Computation Conference, pp. 1055–1062 (2012)
12. Canelas, A., Neves, R., Horta, N.: A SAX-GA Approach to Evolve Investment Strategies
on Financial Markets Based on Pattern Discovery Techniques. Expert Syst. Appl. 40(5),
1579–1590 (2013)
13. Canelas, A., Neves, R., Horta, N.: Multi-dimensional pattern discovery in financial time
series using SAX-GA With extended robustness. In: Proceeding of The Fifteenth Annual
Conference Companion on Genetic and Evolutionary Computation Conference Compa-
nion, pp. 179–180 (2013)
Technical Indicators for Forex Forecasting 97

14. Tiong, L.C.O., Ngo, D.C.L. Ngo, Lee, Y.: Forex trading prediction using linear regression
line, artificial neural network and dynamic time warping algorithms. In: Proc. Fourth Int.
Conf. Comput. Informatics, pp. 71–77 (2013)
15. Tiong, L.C.O., Ngo, D.C.L. Ngo, Lee, Y.: Forex prediction using support vector machine
and dynamic time warping. In: Proceeding of Thirteenth International Conference on
Electronics, Information and Communications (ICEIC), pp. 141–142 (2014)
16. Choi, J.H., Lee, M.K., Rhee, M.W.: Trading S&P 500 stock index futures using a neural
network. In: Proceedings of the Third Annual International Conference on Artificial
Intelligence Applications on Wall Street, pp. 63–72 (1995)
17. Quah, T.S., Srinivasan, B.: Improving Returns on Stock Investment Through Neural
Network Selection. Expert Syst. Appl. 17(4), 295–301 (1999)
18. Yao, J., Tan, C.L.: A Case Study on using Neural Networks to Perform Technical
Forecasting of Forex. Neurocomputing 34(1), 79–98 (2000)
19. Emam, A.: Optimal Artificial Neural Network Topology for Foreign Exchange Forecast-
ing. In: Proceedings of the 46th Annual Southeast Regional Conference on XX, pp. 63–68
(2008)
20. Sher, G.I.: Forex trading using geometry sensitive neural networks. In: Proceedings of The
Fourteenth International Conference on Genetic and Evolutionary Computation
Conference Companion, pp. 1533–1534 (2012)
21. HistData.com. http://www.histdata.com/download-free-forex-data

You might also like