FOREX Rate Prediction using A Hybrid System

DOI : 10.17577/IJERTV3IS110383

Download Full-Text PDF Cite this Publication

Text Only Version

FOREX Rate Prediction using A Hybrid System

Nathan DLima

M.E. Student Computer Department,

St. Francis Institute of Technology Mumbai, India.

Shamsuddin S. Khan Assistant Professor Computer Department,

St. Francis Institute of Technology Mumbai, India.

Abstract Currency exchange is the trading of one currency against another. Forecasting the foreign exchange rate is an uphill task. FOREX rates are influenced by many correlated economic, political and psychological factors. Like many economic time series, FOREX has its own trend, cycle and irregularity. The objective is to predict single day exchange rates with higher accuracy and precision. By using two different methods, i.e. a Neural network and a Hybrid system, a more accurate and robust method can be developed. A Multilayer Perceptron (MLP) is used to predict the rise and fall of the FOREX market while an ANFIS system is used to predict the future rate.

KeywordsFOREX, Forex forecasting, Hybrid System, Multi Layer Perceptron.

  1. INTRODUCTION

    Foreign Currency Exchange or Foreign Exchange is commonly known as FOREX. The foreign exchange market is the place where currencies are traded. The FOREX market is one of the most exciting, fast-paced markets around. FOREX has been the domain of banks, corporations, large financial institutions, etc. It is now possible for average investors and individuals to trade currencies due to the emergence of the internet. This is easily done through online brokerage accounts with the click of a button.

    The foreign exchange market is a global decentralized marketplace that determines the relative values of different currencies. Transactions are not conducted in a centralized depository or exchange. These transactions are conducted by several market participants in several locations. It is very rare that any two currencies will be identical in value to each another. No two currencies will ever maintain the same relative value for more than a short time period. The rate between any two currencies is constantly changing.

    Currencies trade on an open market, just like stocks, bonds, computers, cars, and many other goods and services. A currency's value fluctuates as its supply and demand fluctuates, just like anything else. An increase in supply or a decrease in demand for a currency can cause the value of that currency to fall. A decrease in the supply or an increase in demand for a currency can cause the value of that currency to rise.

    A big benefit to FOREX trading is that you can buy or sell any currency pair, at any time subject to available liquidity. This also means that there really is no such thing as a declining market. You can make (or lose) money when the market is trending up or down [2].

    FOREX markets are forever changing. The market is affected by many factors that are interlinked and correlated. Some of these factors include social, economic, political and psychological factors. It is a chaotic time series like stock market. The FOREX market has a very small margin of profit as compared to other markets. The characteristics of this market that make it unique are

    • Its large trading volume ($4 trillion per day)

    • Continuous operation

    • Its geographic reach

    • Low margins of profit.

  2. RELATED WORK

    Christina and Masoud used three different methods for forecasting exchange rates in [6]. Currency exchange data for US Dollar (USD) and British Sterling Pound (GBP), Euro (EUR) and Swiss Franc (CHF) between 3rd January 2012 and 1st March 2013 was used. The three methods used were Neural Networks (NN), Vector Singular Spectrum Analysis (VSSA) and Recurrent Singular Spectrum Analysis (RSSA). Singular Spectrum Analysis uses diagonal averaging which provides an approximation of the original time series with less noise. This approximation can then be used to forecast new data points. Root Mean Square Error (RMSE) and Direction Change (DC), which is a measure of percentage of the forecasts that accurately predict the direction of change, were used as performance measures. Forecasts for 1 day and 3 days look ahead were done. The methods, however, gave an approximate 48% accuracy in the case of NN while SSA was 67% better than NN with more than 95% confidence.

    Cwiok and Kordos proposed a new method in stock trading strategy in [5]. The approach uses neural networks to determine an optimal buy and sell time for stocks. Stock trading data from 1st January 1995 to 31st December 2004 was used as training set and data from 1st January 2005 to 1st January 2008 was used in testing. This method uses three learning algorithms Standard back propagation with momentum, modified back propagation and variable step search algorithm. The modified back propagation algorithm uses a directional minimization and change of direction by making the gradient components non-linear. Initial Gaussian data was transformed to a uniform distribution by using a hyperbolic tangent function to reduce effect of outliers. The input parameters used were Price range, simple moving average, rate of change, relative strength index, commodity channel index, stochastic oscillator, average true rate and

    candle formations. The time period of price range used was 1, 2 and 3 days while the time period for the remaining inputs were 6, 9, 14 and 21 days. The neural network consists of 2

    hidden layers with each node having a tanh sigmoidal activation function. The output of the neural network is an optimal buy or sell signal for different stocks.

    TABLE I. SUMMARY

    Reference

    Currencies

    Method

    Training Sample

    Performance

    [6] B. Christina, Y. Masoud

    USDGBP USDEUR

    USDCHF

    Neural Network

    Vector Singular Spectrum Analysis Recurrent Singular Spectrum Analysis

    From 3rd January 2012 to 1st March

    2013

    Basic RSSA 60% accuracy Neural Network 48% accuracy

    (SSA 67% better than NN)

    [5] A. Cwiok, M. Kordos

    (Stock Trading)

    Standard Back Propagation with Momentum

    Modified Back Propagation Variable Step Search

    From 1st January 1995 to 31st

    December 2004

    Provides optimal buy and sell signals

    [7] V. Kodogiannis and A. Lolis

    USDGBP

    MLP with Standard Back Propagation RBF

    Autoregressive Recurrent Neural Networks

    Elman Neural Network Adaptive Fuzzy Logic System with BOA

    From end of 1997 to end of March 2000

    % Error

    RMSE

    MLP

    0.31

    0.421

    RBF

    0.2646

    0.3905

    ARNN

    0.2711

    0.4021

    Elman

    0.2683

    0.4010

    AFLS

    0.2514

    0.3939

    [8] A.N. Kia, M. Fathian and M.R. Gholamian

    EURUSD

    Single ARIMA Single MLP Single RBF

    Hybrid Model (ARIMA+MLP+RBF)

    From 1st August 2001 to 31st July 2010

    RMSE

    D-stat

    ARIMA

    0.0081

    65%

    MLP

    0.076

    67%

    RBF

    0.0085

    59%

    Hybrid

    0.0068

    71%

    [4] Emad F, M.A. Montazeri

    EURUSD USDCHF

    IT2FCMFNS

    Fuzzy c-means based type-1 fuzzy system with MLP neural network. (T1FCMFNS) IT2 fuzzy system without clustering

    combined with FLANN neural network. (FLIT2FNS)

    From 1st April 2005 to10th December 2012

    EURUSD

    USDCHF

    FLIT2FNS

    0.00613

    0.00582

    T1FCMFNS

    0.00172

    0.00207

    IT2FCMFNS

    0.00165

    0.00101

    In [7], Kodogiannis and Lolis make use of a hybrid system to predict future rates between the currencies of US Dollar (USD) and British Sterling Pound (GBP). A dataset of 1000 daily rates from the end of 1997 to end of March 2000 was used. Five different methods used were MLP with standard back propagation, RBF, Autoregressive Recurrent Neural Network (ARNN), Elman neural network and Adaptive Fuzzy Logic System (AFLS). MLP uses 5 inputs with 2 hidden layers and a standard back propagation algorithm. RBF network is trained using Orthogonal Least Squares (OLS) method since it can train the network quicker. ARNN has 2 hidden layers and a single output node. It allows recurrence only in the first hidden layer. Elman network has 4 input nodes, 1 output node and 2 hidden layers with 16 and 24 nodes respectively. Self-feedback is applied on the hidden layer with 16 nodes. AFLS is a hybrid neuro-fuzzy system. It has multiple inputs and multiple outputs. A new method called Balance of Area (BOA) is used for defuzzification. This defuzzification method gives a result very close to centroid method. The AFLS method gives the smallest percent error as compared to the other methods.

    Kia, Fathian and Gholamian made use of along with Auto Regressive Integrated Moving Average (ARIMA) in [8]. Simple linear ARIMA cannot be used to model financial data since financial series have high non-linearity, high noise and high complexity. To solve the non-linearity problem, Multilayer Perceptron (MLP) and Radial Basis Function (RBF) were used. The proposed hybrid system is a combination of MLP, RBF and ARIMA. The model calculates the FOREX rate using ARIMA and the error of that was modelled by MLP. The remaining error was then

    given as input to a RBF network to further reduce the final error. It gives a better result as compared to each method individually. 3440 daily exchange rates from 1st August 2001 to 31st July 2010 were used for EUR to USD. The days without data were padded with the average exchange rate value of the last three days. The neural network uses up to 7 days previous data for learning and predicting the rate for the next day. Root Mean Square Error (RMSE) and D-stat (success of prediction in terms of direction) are used as performance parameters.

    Emad and Montazeri in [4] use an Interval Type 2 (IT2) Fuzzy Neural Network. The prediction of Euro (EUR) and Swiss Franc (CHF) is done against US Dollar (USD). This method makes use of a Karnik-Mendel type reducer for Fuzzy C-means clustering and a Multilayer Neural Network. The inputs to the model are closing price, simple moving average (%K) and exponential moving average (%D). The inputs are fuzzified and given as input to the Karnik-Mendel type reducer for fuzzy clustering. The input membership functions are interval type 2 fuzzy membership functions. They use a Gaussian membership function to define the value. The MLP neural network uses the input to predict the future currency rate. It consists of a single hidden layer with 20 neurons. A back-resilient algorithm is used for training the network. 50 epochs were used in the training of the neural network. The algorithm helps to train the neural network quicker. The rule base is a dynamic rule base that takes into account the number of input membership functions. In order to find the best number of clusters to be used and the number of rules, a test was made. The result of the test obtained 7 rules for EURUSD dataset while for the USDCHF dataset, 6

    rules obtained the best result. Data between 1st April 2005 and 10th December 2012 was used as the dataset. Along with the proposed system (IT2FCMFNS), two other neuro-fuzzy methods (FLIT2FNS and T1FCMFNS) were compared. The proposed system was better than the other methods. The experimental results showed that the system could handle fluctuations with a high degree of accuracy.

    Table 1 summarizes the various methods discussed above. It summarizes the currencies exchanged, method used, training samples and performance measures of each of the methods.

  3. PROPOSED SYSTEM

    As seen in the literature, many methods have been used to predict the future FOREX rates. Some of the common methods include statistical analysis, time series analysis, etc. Some of the modern methods used are fuzzy systems, neural networks, hybrid systems, etc. These methods suffer from the problem of accurately predicting the exchange rates with low accuracy and precision. A hybrid system is a combination of two or more methods which provides much better results as compared to the other individual methods.

    The proposed system uses two separate methods. The first

    Fig. 2. ANFIS Architecture [9]

    The second method makes use of a neuro-fuzzy hybrid system to predict the future FOREX rate. Adaptive Neuro- Fuzzy Inference System (ANFIS) will be used to implement this method. This model takes the closing price and moving average as input and predicts the future exchange rate.

    Fig. 2 shows the architecture of the ANFIS model [9]. The 2 inputs are given to the first layer which is a fuzzification layer. The inputs are fuzzified using a Gaussian membership function given by (1).

    method makes use of MLP neural network as used in [5] for predicting optimal buy and sell times for a particular stock. The same method is applied to FOREX prediction. It shows

    (x ) exp

    A 1

    1

    (x1 c1 )2

    2 2

    (1)

    whether the market rises or falls based on previous learning. It takes 4 inputs Closing price, moving average, rate of change and stochastic oscillator, to predict the trend of the market. The MLP network uses supervised learning and a standard back propagation algorithm to predict the direction of the market.

    Layer 1 contains adaptive nodes which fuzzifies the inputs and gives it to the second layer. Each node in this layer is a fixed node labeled . This layer calculates the firing strength of the antecedents using T-norm or T-conorm operators as in (2). Here we obtain output of the ith node in the jth layer.

    O j,i wi A (x)B ( y), i 1,2

    (2)

    i i

    The output of this layer is then normalized by the third layer which is a fixed node labeled N. This layer normalizes the weights using (3). This is called the normalized firing strength. The ith node calculates the ith rules firing strength to the sum of the firing strength of all the rules.

    Wi

    Wi

    n

    Wi

    i1

    ,i 1, 2

    (3)

    Where n is the number of nodes in the layer 2. W i is the

    Fig. 1. MLP Neural Network with Back Propagation

    The model is described in Fig. 1 shows the MLP neural network along with back propagation. There are 4 inputs, 2 hidden layers and a single output node. The 2 hidden layers have 8 and 4 neurons respectively. All neurons use a bipolar continuous activation function. The back propagation uses

    normalized weight that is given to the adaptive node in layer

    4. This layer calculates the firing strength of the consequents using the rule base. The output is dependent on the type of Fuzzy Inference System (FIS) being used, in this case a 2- input first order Sueno FIS. The output of this layer is defined by the function shown in (4).

    delta learning rule to train the network. After each iteration,

    fi pi x qi x ri

    (4)

    the error of the predicted output is checked with the actual rise and fall of the market. If an error exists, the weights are updated else the network continues training. If the final error is more than the preset threshold value then the training is done again with a larger dataset. The number of neurons in the hidden layer will be determined based on the final error. The number of neurons needs to be optimized to give the least possible error and as a result much greater accuracy.

    The final output is given by the node in layer 5. It computes the output as the summation of all the incoming signals. Since the weights are already normalized it calculates the sum of the product of all the input signals with their corresponding weights as shown in (5).

    O wi f i i

    wi f i

    (5)

    significant. When trading in large amounts, the forecast helps to decide optimal moments to buy or sell.

    i i wi

    The error between the predicted output and actual output is checked. If some error exists then the premise parameters are updated using gradient descent method.

  4. EXPERIMENTAL SETUP

    This experiment will require a desktop computer running windows 7 Home Basic or better with at least 2 GB RAM and a 200 GB hard drive. Internet connection with suitable speed is required. The experiment will be run in MATLAB2013.

    The daily closing exchange rates between USD and INR are obtained from 23rd October, 1993 to 23rd October, 2014. This data set is obtained from [3]. Preprocessing is required on this data set to separate the date from slash notation (23/10/1993) to comma notation (23,10,1993). The dataset is stored as comma separated value (csv) file.

  5. SUMMARY

    The aim of the proposed system is to accurately predict the FOREX rate for a pair of currencies. The system predicts the exchange rate as well as predicts the trend of the FOREX market. The trend prediction acts as a parameter to check the accuracy of the predicted rate. The trend prediction using MLP Neural Network combined with the neruo-fuzzy ANFIS system can provide a robust and accurate method to predict the future exchange rates. This is beneficial not only to large banks and corporations that trade currency but also investors and individuals who seek to invest or migrate to a foreign country. The prediction will help to devise a strategy that maximizes the profits while minimizing the risks. The FOREX market is highly fluctuating like the stock market but due to its low margin of profit the losses are not as

  6. FUTURE SCOPE

The forecasting of foreign exchange rates can be further enhanced using better algorithms that can predict the rates hourly or possibly at smaller intervals. This can help in intra- day investments by governments, banks or large companies that trade large amounts.

REFERENCES

  1. FOREX market, Available: http://www.investopedia.com/university/ FOREXmarket/

  2. What is FOREX, Available: http://www.fxcm.com/markets/FOREX- basics/what-is-FOREX/

  3. Historical FOREX data, Available : http://www.oanda.com/currency

    /historical-rates/

  4. Emad F, M.A. Montazeri, Forecasting Foreign Exchange Rates Using an IT2 FCM based IT2 Neuro-Fuzzy System in 21st Iranian Conference on Electrical Engineering (ICEE), 2013.

  5. A. Cwiok, M. Kordos, A New Approach to Neural Network Based Stock Trading Strategy, in Intelligent Data Engineering and Automated Learning – IDEAL 2011 Lecture Notes in Computer Science Volume 6936, 2011, pp 429-436.

  6. B. Christina, Y. Masoud, Forecasting Exchange Rates: An Optimal Approach in J Syst Sci Complex (2014) 27: 2128.

  7. V. Kodogiannis and A. Lolis, "Prediction of foreign exchange rates by neural network and fuzzy system based techniques," in European Symposium on Artificial Neural Networks Bruges (Belgium), April 2001, pp. 245-250

  8. A.N. Kia, M. Fathian and M.R. Gholamian, Using MLP and RBF Neural Networks to Improve the Prediction of Exchange Rate Time Series with ARIMA, International Journal of Information and Electronics Engineering, Vol. 2, No. 4, 2012, pp. 543-546

  9. J.S.R. Jang, C.T. Sun and E. Mizutani, Neuro-Fuzzy and Soft Computing A Computational Approach to Learning and Machine Intelligence, Prentice-Hall Inc., 1997.

Leave a Reply