# Exchange Rate Forecasting Based on Deep Learning and NSGA-II Models

Authors: Jun Chen; Chenyang Zhao; Kaikai Liu; Jingjing Liang; Huan Wu; Shiyan Xu
Journal: Computational Intelligence and Neuroscience
 (2021)

---

## Abstract

Today, the global exchange market has been the world’s largest trading market, whose volume could reach nearly 5.345 trillion US dollars, attracting a large number of investors. Based on the perspective of investors and investment institutions, this paper combines theory with practice and creatively puts forward an innovative model of double objective optimization measurement of exchange forecast analysis portfolio. To be more specific, this paper proposes two algorithms to predict the volatility of exchange, which are deep learning and NSGA-II-based dual-objective measurement optimization algorithms for the exchange investment portfolio. Compared with typical traditional exchange rate prediction algorithms, the deep learning model has more accurate results and the NSGA-II-based model further optimizes the selection of investment portfolios and finally gives investors a more reasonable investment portfolio plan. In summary, the proposal of this article can effectively help investors make better investments and decision-making in the exchange market.


---

## Body

## 1. Introduction

No matter for the purpose of exchange investment or exchange hedging, accurate exchange analysis and forecasting and exchange derivatives trading strategy have become the research contents of institutions and individuals in various countries [1]. A growing number of government agencies, economists, and financial institutions begin to pay attention to the use of financial models to analyze the macro parameters of dynamic time series to predict the exchange rate [2].However, building a high-precision financial time series prediction model is still a difficult and important topic for scientists, economists, and decision-makers. Traditional methods often fail to capture the complex characteristics of discontinuous, nonlinear, and high frequency in exchange financial time series dataset [3]. In this context, from the perspective of individual or institutional exchange traders, this paper constructs a dual-objective optimization econometric model of exchange forecast analysis portfolio from the whole process of exchange trading platform selection data collection exchange rate analysis exchange portfolio optimization selection, in order to achieve more accurate forecast portfolio selection through technical analysis, the maximization of income and the minimization of portfolio risk [4]. Deep learning has not been widely used in time series prediction, but it has been explored; at present, scholars mainly focus on the time series prediction based on the DBN algorithm, while the time series prediction based on the SRU deep network model is rarely completed [5].The rest of the paper is organized as follows: Section2 is related work on exchange rate forecasting models. Section 3 contains the design based on the deep learning model, which is described in detail in this paper. Section 4 contains the results of the deep learning model. Section 5 concludes some important findings.


## 2. Related Work

For a long time, the study of exchange rate forecasting models has attracted many scientists, economists, and economic policy decision-makers. On the whole, the previous literature mainly explored three areas: first, most studies adopted time-based conditional heteroscedasticity in the standard model and used variability as the main parameter. These models can be classified as the famous ARCH and GARCH methods first proposed by Ayachi et al. [6]. This type of model describes the evolution of the importance of uncertainty and also shows the time evolution of the average square error. Although the ARCH and GARCH frameworks have been proven to be very effective in predicting volatility changes, the academic circles have not been able to unify the economic explanations for the final clustering of uncertainty. Therefore, in [7], the variability equivalent to a one-year period is very predictable, but in [8], as well as [9], all of the research results confirmed that the predictability of volatility mainly exists in a short-term dimension. In addition, it is further proposed that the effectiveness of the model based on ARCH evaluation is also significantly affected by structural changes. Secondly, another type of exchange rate forecasting model attempts to establish a reasonable expectation hypothesis by rationally analyzing the characteristics of macro fundamentals and further constructs an exchange rate forecasting model [10]. These models are often based on the analysis of the domestic currency and the supply and demand of a currency. The longest cited analysis indicators generally include relative inflation rate, relative basic interest rate, gross domestic product, trade balance, income level, and other parameters [11]. In a nutshell, this type of forecasting model is generally based on an average purchasing power model, a covered or noncovered interest rate evaluation model, and a currency model. However, this type of forecasting model based on macro fundamental analysis also exposes a series of shortcomings and deficiencies. For example, policy factors in various countries and changes in investor psychology often lead to unpredictable black-market speculation, or different influencing factors often occur in different periods, producing a variety of impact results [13]. Therefore, in [14], it is pointed out that the predictive ability of this kind of structured model in the short term cannot even be a pure random walk model. As deep learning returns to the mainstream of research and attracts more and more attention from researchers, deep learning algorithms have also completed the exploration of empirical applications in many fields, including time series forecasting [15]. Yao et al. proposed a DBN model composed of a multilayer strict Bozeman machine for time series forecasting [16]. This model uses ATS benchmark data and the particle swarm optimization algorithm. In this research, the DBN algorithm has been proved to successfully surpass the traditional MP neural network model and statistical model ARIMA. Hu et al. proposed a method based on deep learning, and the integrated algorithm of the DBN model is used for time series forecasting [17]. Peng et al. proposed a deep structure based on DBN model multitask learning for traffic flow forecasting [18]. In addition, Prusa and Khoshgoftaar used the training set to construct an overcomplete dictionary and proposed a time series prediction based on sparse coding [19]. Parwez et al. used the sparse coding model to expand the method of online time series prediction and solved the L1-standard convex optimization problem for each new time series vector [20]. Finally, nowadays, more and more exchange forecasting model researchers have begun to shift their thinking to the field of artificial intelligence. Most of this type of research results use time series statistics to predict the movement of currency exchange rates, and it has gradually been proved to greatly surpass traditional predictions. Method [21]: this type of forecasting method mainly includes regression models and agency models based on the concept of behavioral finance and genetic algorithms and artificial neural network models; these models often fall into the trap of local minimums [22]. In addition to supporting vector regression, the SVR model is considered to be a stronger prediction method than the ANN model because it can achieve global optimization [23]. All in all, among a large number of parameter statistical models, ANN has the advantage of being less affected by its model misidentification problem, and it is the most used predictive model so far [24]. After years of improvement and optimization, although significant improvements have been achieved in the accuracy of the model, it still cannot surpass the maximum hidden layer setting of 2 layers due to the problem of nonconvex optimization. Therefore, the difficulty of using deep networks to improve accuracy has been unable to move forward [25–30].This article combines theory with practice and innovatively proposes an innovative model of dual-objective optimization measurement for exchange rate forecasting and analysis of investment portfolio. On the whole, the dual-objective optimization measurement model of exchange forecasting and analysis investment portfolio proposed in this paper proposes a selection of data collection from exchange trading platforms, which has a strong reference and guiding significance for the practical application of exchange investors. Specifically, the significance of the two core algorithms proposed by the model is as follows: the exchange rate prediction algorithm based on SRU deep learning obtains more accurate results than typical traditional exchange rate prediction algorithms (such as neural networks and support vector machines); the dual-objective measurement optimization algorithm of the investment portfolio further uses the results predicted by the above model to optimize the selection of investment portfolios and finally gives investors a more reasonable investment portfolio plan.


## 3. Exchange Rate Forecast Analysis and Portfolio Optimization Econometric Model Design Based on Deep Learning

### 3.1. Deep Learning Model

Taking a typical single output neural network as an example, Figure1 shows a neural network with three input units, three hidden units, and one output unit.Figure 1
Single output small neural network structure diagram.The parameter of the neural network is defined asW,b=W1,b1,W2,b2, where W1 represents the parameter connecting the j-th element of layer L and the first element of layer L + 1, and b1 represents the deviation of the i-th element of layer L + 1. Therefore, in the neural network structure shown in Figure 1, W1∈ℜ3×3, W2∈ℜ3×3; in addition, the parameter W1∈ℜ3×3 is defined as the activation factor of the i-th unit of layer L, which can also be understood as the output of the neural unit, and the output of layer L3 is defined as hw,bx. In the structure shown in Figure 1, the data parameter is a numerical value. So far, the structure function relationship of the neural network can be expressed as in the following formulas:(1)ai1=fw111χ1+w121χ2+w131χ3+b11,a22=fw211χ1+w221χ2+w231χ3+b21,a32=fw311χ1+w321χ2+w331χ3+b31,hwbx=a13=fw112a12+w122a22+w132a32+b12.Generally, there are two choices in a neural network; one is sigmoid function:(2)fz=11+exp−z.Another commonly used activation function is the hyperbolic tangent function (tanh function):(3)fz=tanhz=ez−e−zez+e−z.Take a typical small single output neural network as an example, as shown in Figure2: Layer I1 is the input layer (Input), Layer L3 is the output layer (Output), and Layer L2 is the hidden layer because its neurons cannot be observed. As shown in Figure 2, the neuron marked with +1 is a deviation unit, which is equivalent to an intercept term. All in all, this is a neural network with three input units, three hidden units, and one output unit.Figure 2
Distribution of deep learning algorithm integrated by SAE-SVR. (a) Process 1. (b) Process 2. (c) Process 3. (d) Process 4. (e) Process K.
(a)(b)(c)(d)(e)When the network structure is more complex, in order to make the structure function more concise and clear, the weighted sum of the input parameters of the i-th unit of layerL is defined as zil and then zi2=∑j=1nWij1xj+bil; therefore, ail=fzils. The structure of the neural network is written as a more concise function, which is as follows:(4)z2=W1x+b1,(5)a2=fz2,(6)z3=W2a2+b2,(7)hw,bx=a3=fz3.This article will use the deep learning algorithm that has good performance in extracting dataset features, and the SAE-SVR algorithm is integrated to enhance its prediction ability. Therefore, this paper finally proposes an innovative integration algorithm for a more accurate prediction of time series. The following will be the introduction of the innovative deep learning algorithm based on SAE-SVR.Its structure is shown in Figure3. The neural network structure discussed before is often based on the situation that the number of hidden layer units S2 of L2 layer is small, but when the number of hidden layer units is large (even far larger than the number of input), it can still get better performance by imposing hidden layer restrictions.Figure 3
The integrated model structure of deep learning algorithm based on SAE-SVR integration.Specifically, this paper constructs a system with an input layer, an output layer, and K hidden layers of the deep neural network; each layer is composed of sparse coding. The whole process can be divided into six steps as shown in Figure3.


### 3.2. Exchange Rate Forecast Analysis and Portfolio Optimization

From the perspective of individual or institutional investors in exchange trading, this paper explores the core process of exchange data analysis and portfolio measurement and selection in the process of exchange derivatives trading and investment. In the past, exchange-related research only focused on the research of exchange influencing factors, exchange determinant model, exchange rate forecast, and other fields. Standing in the whole process of exchange investment and trading, they generally showed the characteristics of a single link. The authors of this paper propose an overall framework of exchange derivatives investment analysis trading, as shown in Figure4.Figure 4
Forex Analysis: the overall framework of the trading model.For a diversified exchange portfolio, the fundamental purpose of portfolio selection among different exchange currency pairs is to maximize the return and minimize the risk. For the diversified exchange portfolio involved in this paper, the return vector of N assets is set asR = (R, R, RZ), which skillfully represents the proportion of investment and the i-th exchange asset. The expected return of the portfolio is expressed as Er (x); the risk of the portfolio is expressed as IR (x); con (R, R) is the covariance of the i-th exchange rate and the j-th exchange rate; and then the double objective measurement model of exchange portfolio is established as follows:(8)maxER=∑i=1NxiRiminVRλ=∑i=1iνxistdRis.t.∑i=1Nxi=1,xi≥0,i=1,2,…,N,N=28.Under the condition that the expected return rate ER (R) is the largest and the risk VR (R) of the portfolio is the smallest, the investment allocation scheme of the portfolio is obtained. In the process of realizing the dual-objective measurement model of diversified exchange portfolio for 28 currency pairs, this paper adopts NSGA-II, which is a fast nondominated sorting genetic algorithm model with an elitist strategy proposed by Kalyanmoy Deb. NSGA-II is an improvement on the NSGA algorithm. The NSGA algorithm is a genetic algorithm based on Pareto sorting, which can directly solve multiobjective optimization problems. Each time, it can get a different set of noninferior solutions. The innovation of NSGA-II lies in the hierarchical design of noninferior sorting algorithm and the crowding distance, which can find a good Pareto optimal solution, quickly approach the Pareto frontier, and greatly improve the performance of the NSGA algorithm.Specifically, the flow of the two-objective measurement optimization algorithm based on NSGA-II is shown in Figure5. In the NSGA-II algorithm, the three core steps are as follows:Step 1: design of the fast nondominant sorting operator.The key to designing a multiobjective optimization problem is to find Pareto optimal solution set. The fast nondominant ordering in the NSGA-II algorithm is to layer the population according to the level of noninferior solution, and its function is to guide the search to Pareto optimal solution set direction. It is a cyclic adaptive value grading process. Firstly, the nondominant solution set in the group is found, and the first nondominant layerf is identified. All the individuals are given (where I is the nondominant order value of individual I) and are removed from the whole group: then, the nondominant solution set in the remaining group is found, the second nondominant layer F2 is recorded, and the individual is given. This is done until the whole population is stratified, and the individuals within the same layer have the same nondominant order m∗.Step 2: the design of the individual crowding distance operator.In order to be able to sort selectively within individuals, NSGA-II proposes the concept of individual crowding distance. The crowding distance of individual I is the distance between the two individualsI + 1 and I − 1 adjacent to I in the target space. The calculation steps are as follows:I. Initialize the distance for the same layer individual. Make l[l] = 0 (where l[l] represents the crowded distance of any individual I).II. The individuals in the same layer are arranged in ascending order of the m-objective function value.III. Make the individuals on the sorting edge have the choice advantage. Given a large number W, make z[0] = z[i] = 0.IV. For individuals in the middle of the order, the crowding distance is calculated.V. For different objective functions, repeat steps II–IV to get the crowding distance 4L of individual I. by selecting the individuals with large crowding distance as a priority, the results can be distributed evenly in the target space to maintain the diversity of the population.Step 3: the design of elite strategy selection operator.Elite strategy is to keep the excellent individuals in the parent generation directly into the offspring, so as to prevent the loss of Pareto optimal solution. The elite strategy selection operator is divided into three indexes by the parentC, P, the offspring P, and the synthetic population R. The optimal selection was carried out to form a new parent population C. Finally, the order of filling C from large to small is continued according to the crowd distance of individuals in Fi until the population number reaches N.Figure 5
NSGA-II-based forex portfolio dual-objective metering optimization algorithm process.


## 3.1. Deep Learning Model

Taking a typical single output neural network as an example, Figure1 shows a neural network with three input units, three hidden units, and one output unit.Figure 1
Single output small neural network structure diagram.The parameter of the neural network is defined asW,b=W1,b1,W2,b2, where W1 represents the parameter connecting the j-th element of layer L and the first element of layer L + 1, and b1 represents the deviation of the i-th element of layer L + 1. Therefore, in the neural network structure shown in Figure 1, W1∈ℜ3×3, W2∈ℜ3×3; in addition, the parameter W1∈ℜ3×3 is defined as the activation factor of the i-th unit of layer L, which can also be understood as the output of the neural unit, and the output of layer L3 is defined as hw,bx. In the structure shown in Figure 1, the data parameter is a numerical value. So far, the structure function relationship of the neural network can be expressed as in the following formulas:(1)ai1=fw111χ1+w121χ2+w131χ3+b11,a22=fw211χ1+w221χ2+w231χ3+b21,a32=fw311χ1+w321χ2+w331χ3+b31,hwbx=a13=fw112a12+w122a22+w132a32+b12.Generally, there are two choices in a neural network; one is sigmoid function:(2)fz=11+exp−z.Another commonly used activation function is the hyperbolic tangent function (tanh function):(3)fz=tanhz=ez−e−zez+e−z.Take a typical small single output neural network as an example, as shown in Figure2: Layer I1 is the input layer (Input), Layer L3 is the output layer (Output), and Layer L2 is the hidden layer because its neurons cannot be observed. As shown in Figure 2, the neuron marked with +1 is a deviation unit, which is equivalent to an intercept term. All in all, this is a neural network with three input units, three hidden units, and one output unit.Figure 2
Distribution of deep learning algorithm integrated by SAE-SVR. (a) Process 1. (b) Process 2. (c) Process 3. (d) Process 4. (e) Process K.
(a)(b)(c)(d)(e)When the network structure is more complex, in order to make the structure function more concise and clear, the weighted sum of the input parameters of the i-th unit of layerL is defined as zil and then zi2=∑j=1nWij1xj+bil; therefore, ail=fzils. The structure of the neural network is written as a more concise function, which is as follows:(4)z2=W1x+b1,(5)a2=fz2,(6)z3=W2a2+b2,(7)hw,bx=a3=fz3.This article will use the deep learning algorithm that has good performance in extracting dataset features, and the SAE-SVR algorithm is integrated to enhance its prediction ability. Therefore, this paper finally proposes an innovative integration algorithm for a more accurate prediction of time series. The following will be the introduction of the innovative deep learning algorithm based on SAE-SVR.Its structure is shown in Figure3. The neural network structure discussed before is often based on the situation that the number of hidden layer units S2 of L2 layer is small, but when the number of hidden layer units is large (even far larger than the number of input), it can still get better performance by imposing hidden layer restrictions.Figure 3
The integrated model structure of deep learning algorithm based on SAE-SVR integration.Specifically, this paper constructs a system with an input layer, an output layer, and K hidden layers of the deep neural network; each layer is composed of sparse coding. The whole process can be divided into six steps as shown in Figure3.


## 3.2. Exchange Rate Forecast Analysis and Portfolio Optimization

From the perspective of individual or institutional investors in exchange trading, this paper explores the core process of exchange data analysis and portfolio measurement and selection in the process of exchange derivatives trading and investment. In the past, exchange-related research only focused on the research of exchange influencing factors, exchange determinant model, exchange rate forecast, and other fields. Standing in the whole process of exchange investment and trading, they generally showed the characteristics of a single link. The authors of this paper propose an overall framework of exchange derivatives investment analysis trading, as shown in Figure4.Figure 4
Forex Analysis: the overall framework of the trading model.For a diversified exchange portfolio, the fundamental purpose of portfolio selection among different exchange currency pairs is to maximize the return and minimize the risk. For the diversified exchange portfolio involved in this paper, the return vector of N assets is set asR = (R, R, RZ), which skillfully represents the proportion of investment and the i-th exchange asset. The expected return of the portfolio is expressed as Er (x); the risk of the portfolio is expressed as IR (x); con (R, R) is the covariance of the i-th exchange rate and the j-th exchange rate; and then the double objective measurement model of exchange portfolio is established as follows:(8)maxER=∑i=1NxiRiminVRλ=∑i=1iνxistdRis.t.∑i=1Nxi=1,xi≥0,i=1,2,…,N,N=28.Under the condition that the expected return rate ER (R) is the largest and the risk VR (R) of the portfolio is the smallest, the investment allocation scheme of the portfolio is obtained. In the process of realizing the dual-objective measurement model of diversified exchange portfolio for 28 currency pairs, this paper adopts NSGA-II, which is a fast nondominated sorting genetic algorithm model with an elitist strategy proposed by Kalyanmoy Deb. NSGA-II is an improvement on the NSGA algorithm. The NSGA algorithm is a genetic algorithm based on Pareto sorting, which can directly solve multiobjective optimization problems. Each time, it can get a different set of noninferior solutions. The innovation of NSGA-II lies in the hierarchical design of noninferior sorting algorithm and the crowding distance, which can find a good Pareto optimal solution, quickly approach the Pareto frontier, and greatly improve the performance of the NSGA algorithm.Specifically, the flow of the two-objective measurement optimization algorithm based on NSGA-II is shown in Figure5. In the NSGA-II algorithm, the three core steps are as follows:Step 1: design of the fast nondominant sorting operator.The key to designing a multiobjective optimization problem is to find Pareto optimal solution set. The fast nondominant ordering in the NSGA-II algorithm is to layer the population according to the level of noninferior solution, and its function is to guide the search to Pareto optimal solution set direction. It is a cyclic adaptive value grading process. Firstly, the nondominant solution set in the group is found, and the first nondominant layerf is identified. All the individuals are given (where I is the nondominant order value of individual I) and are removed from the whole group: then, the nondominant solution set in the remaining group is found, the second nondominant layer F2 is recorded, and the individual is given. This is done until the whole population is stratified, and the individuals within the same layer have the same nondominant order m∗.Step 2: the design of the individual crowding distance operator.In order to be able to sort selectively within individuals, NSGA-II proposes the concept of individual crowding distance. The crowding distance of individual I is the distance between the two individualsI + 1 and I − 1 adjacent to I in the target space. The calculation steps are as follows:I. Initialize the distance for the same layer individual. Make l[l] = 0 (where l[l] represents the crowded distance of any individual I).II. The individuals in the same layer are arranged in ascending order of the m-objective function value.III. Make the individuals on the sorting edge have the choice advantage. Given a large number W, make z[0] = z[i] = 0.IV. For individuals in the middle of the order, the crowding distance is calculated.V. For different objective functions, repeat steps II–IV to get the crowding distance 4L of individual I. by selecting the individuals with large crowding distance as a priority, the results can be distributed evenly in the target space to maintain the diversity of the population.Step 3: the design of elite strategy selection operator.Elite strategy is to keep the excellent individuals in the parent generation directly into the offspring, so as to prevent the loss of Pareto optimal solution. The elite strategy selection operator is divided into three indexes by the parentC, P, the offspring P, and the synthetic population R. The optimal selection was carried out to form a new parent population C. Finally, the order of filling C from large to small is continued according to the crowd distance of individuals in Fi until the population number reaches N.Figure 5
NSGA-II-based forex portfolio dual-objective metering optimization algorithm process.


## 4. Model Evaluation Results

### 4.1. Evaluation Standard of the Econometric Model

Referring to the evaluation of the traditional time prediction model, this paper uses three statistical parameters: mean absolute error, mean square error, and root mean square error as the standard to evaluate the effectiveness and accuracy of the integration algorithm proposed in this paper. The specific calculation method is as follows:(9)MAE=∑i=1n|y∧l−yi|n,MSE=∑i=1nyl−yi2n,RMSE=∑i=1nyl−yi2n.


### 4.2. Empirical Results of the Artificial Neural Network Model

In this paper, the time series toolbox of the MATLAB r2o15a system is used for the study using the proposed model. In this part, the EURUSD dataset is taken as an example.First of all, data conversion should be carried out according to the data format required by the MATLAB time series toolbox. The algorithm is as follows:Step 1: import the exchangeate.xlsx file containing the time series information of 28 currencies to the MATLAB workspace.Step 2: extract the 1eurusd dataset in exchangerate.xlsx, which is in the double storage format.Step 3: create an empty cell array with the same size as the 1eurusd dataset.Step 4: use the loop statement to store the double data of 1eurusd in the cell array.Step 5: save the cell array in .Mat format to bin file, and name it 1eurusd. Mat.After dealing with the dataset format in accordance with Ann toolbox, the toolbox based on MATLAB r2015a can choose the visual toolbox or the algorithm based onM code. Firstly, this paper uses visualization tools to carry out 1eurusd data training and testing process; the specific process is as follows.First of all, based on the characteristics of financial time series, this paper selects the NAR structure network, that is, the model of nonlinear autoregressive, for empirical study.Secondly, the training set, validation set, and testing set of the whole EURUSD dataset are divided into 70%, 20%, and 10%. Among them, the training set is used to train the neural network step by step, in order to maximize the network parameters in line with the characteristics of the dataset, but if the training is excessive, it will produce an overfitting phenomenon, so the validation set is used to judge and prevent the neural network from overtraining. After the training set and validation set, the neural network gets a fixed parameter which will not change. The testing set uses it to evaluate the performance of network training.Thirdly, we need to set the network structure, and temporarily determine that the hidden layer element is 10 and the lag window is 6. Because the neural network debugging is a process of feedback and adjustment according to the training results, the subsequent empirical study will continue to adjust the number of hidden layer units and lag window until it meets the standard.The training effect of the neural network is mainly determined by two parameters. They are error autocorrelation and time series response, respectively. The performance of the neural network is judged according to the performance of the error values displayed by these two parameters. It can be judged from Figures6 and 7 that the autocorrelation error of the error autocorrelation is within the confidence interval, and the error between the predicted value and the actual value is also around 0, so the proposed model performs well.Figure 6
Correlation results for the proposed model.Figure 7
Time series response results for the proposed model.Further investigation of its MSE value shows that, as shown in Figure8, the best MSE result of its validation set is 2.2106 × 10−4.Figure 8
Prediction of the MSE value of the model based on deep learning.However, considering that the implementation of the deep learning algorithm of graphic visualization is intuitive and easy to understand, it has a large limitation and not strong extension, which cannot fully meet the needs of this experiment. Therefore, this paper also improves the algorithm code of the deep learning model.


### 4.3. Empirical Results of the Support Vector Regression Model

The STR model algorithm used in this paper adopts the libswm version 3.21 toolbox jointly developed by Chih Chung Chang and Chih Jen Lin and updated in December 2015. In the specific empirical process, we still need to preprocess the data first. Taking the EURUSD dataset as an example, the SVM type selected in this paper is Nu SVR, and the radial basis kernel function, namely,e∗, is used. The gamma value set in this paper is 0.06. According to the above process, this paper further makes an empirical calculation on 28 currency pair datasets, and the results are summarized in Table 1.Table 1
Empirical regression test results of 28 currency pairs dataset SVR.
DatasetMSEMAERMSE1EURUSD0.00260980.03990.0510872GBPUSD0.00115280.02720.0339543AUDUSD0.00031450.01430.0177354EURGBP0.00151290.03070.0388965USDCAD0.00223630.03320.047296EURCAD0.00057570.01890.0239957GBPCAD0.00079860.02150.0282598AUDCAD0.000680210.01980.026089EURAUD0.000249620.01140.01579910GBPAUD0.000622550.01910.02495111USDJPY0.004653980.05670.0682212EURJPY0.000344660.01420.01856513GBPJPY0.001412360.02990.03758114CADJPY0.000553660.01770.0235315AUDJPY0.00029190.01290.01708716USDCHF0.00096690.01540.03109517EURCHF0.00225570.03040.04749418GBPCHF0.00105260.01550.03244419CADCHF0.001114760.02080.03338820AUDCHF0.00159790.02680.03997421CHFJPY0.00144230.02240.03797822USDCNY0.001037690.01350.03221323EURCNY0.00173010.03180.04159424GBPCNY0.000526410.01630.02294325CADCNY0.00454050.05360.06738326AUDCNY0.002556960.04030.05056627JPYCNY0.002556960.03490.04235628CHFCNY0.03163330.17280.177857


## 4.1. Evaluation Standard of the Econometric Model

Referring to the evaluation of the traditional time prediction model, this paper uses three statistical parameters: mean absolute error, mean square error, and root mean square error as the standard to evaluate the effectiveness and accuracy of the integration algorithm proposed in this paper. The specific calculation method is as follows:(9)MAE=∑i=1n|y∧l−yi|n,MSE=∑i=1nyl−yi2n,RMSE=∑i=1nyl−yi2n.


## 4.2. Empirical Results of the Artificial Neural Network Model

In this paper, the time series toolbox of the MATLAB r2o15a system is used for the study using the proposed model. In this part, the EURUSD dataset is taken as an example.First of all, data conversion should be carried out according to the data format required by the MATLAB time series toolbox. The algorithm is as follows:Step 1: import the exchangeate.xlsx file containing the time series information of 28 currencies to the MATLAB workspace.Step 2: extract the 1eurusd dataset in exchangerate.xlsx, which is in the double storage format.Step 3: create an empty cell array with the same size as the 1eurusd dataset.Step 4: use the loop statement to store the double data of 1eurusd in the cell array.Step 5: save the cell array in .Mat format to bin file, and name it 1eurusd. Mat.After dealing with the dataset format in accordance with Ann toolbox, the toolbox based on MATLAB r2015a can choose the visual toolbox or the algorithm based onM code. Firstly, this paper uses visualization tools to carry out 1eurusd data training and testing process; the specific process is as follows.First of all, based on the characteristics of financial time series, this paper selects the NAR structure network, that is, the model of nonlinear autoregressive, for empirical study.Secondly, the training set, validation set, and testing set of the whole EURUSD dataset are divided into 70%, 20%, and 10%. Among them, the training set is used to train the neural network step by step, in order to maximize the network parameters in line with the characteristics of the dataset, but if the training is excessive, it will produce an overfitting phenomenon, so the validation set is used to judge and prevent the neural network from overtraining. After the training set and validation set, the neural network gets a fixed parameter which will not change. The testing set uses it to evaluate the performance of network training.Thirdly, we need to set the network structure, and temporarily determine that the hidden layer element is 10 and the lag window is 6. Because the neural network debugging is a process of feedback and adjustment according to the training results, the subsequent empirical study will continue to adjust the number of hidden layer units and lag window until it meets the standard.The training effect of the neural network is mainly determined by two parameters. They are error autocorrelation and time series response, respectively. The performance of the neural network is judged according to the performance of the error values displayed by these two parameters. It can be judged from Figures6 and 7 that the autocorrelation error of the error autocorrelation is within the confidence interval, and the error between the predicted value and the actual value is also around 0, so the proposed model performs well.Figure 6
Correlation results for the proposed model.Figure 7
Time series response results for the proposed model.Further investigation of its MSE value shows that, as shown in Figure8, the best MSE result of its validation set is 2.2106 × 10−4.Figure 8
Prediction of the MSE value of the model based on deep learning.However, considering that the implementation of the deep learning algorithm of graphic visualization is intuitive and easy to understand, it has a large limitation and not strong extension, which cannot fully meet the needs of this experiment. Therefore, this paper also improves the algorithm code of the deep learning model.


## 4.3. Empirical Results of the Support Vector Regression Model

The STR model algorithm used in this paper adopts the libswm version 3.21 toolbox jointly developed by Chih Chung Chang and Chih Jen Lin and updated in December 2015. In the specific empirical process, we still need to preprocess the data first. Taking the EURUSD dataset as an example, the SVM type selected in this paper is Nu SVR, and the radial basis kernel function, namely,e∗, is used. The gamma value set in this paper is 0.06. According to the above process, this paper further makes an empirical calculation on 28 currency pair datasets, and the results are summarized in Table 1.Table 1
Empirical regression test results of 28 currency pairs dataset SVR.
DatasetMSEMAERMSE1EURUSD0.00260980.03990.0510872GBPUSD0.00115280.02720.0339543AUDUSD0.00031450.01430.0177354EURGBP0.00151290.03070.0388965USDCAD0.00223630.03320.047296EURCAD0.00057570.01890.0239957GBPCAD0.00079860.02150.0282598AUDCAD0.000680210.01980.026089EURAUD0.000249620.01140.01579910GBPAUD0.000622550.01910.02495111USDJPY0.004653980.05670.0682212EURJPY0.000344660.01420.01856513GBPJPY0.001412360.02990.03758114CADJPY0.000553660.01770.0235315AUDJPY0.00029190.01290.01708716USDCHF0.00096690.01540.03109517EURCHF0.00225570.03040.04749418GBPCHF0.00105260.01550.03244419CADCHF0.001114760.02080.03338820AUDCHF0.00159790.02680.03997421CHFJPY0.00144230.02240.03797822USDCNY0.001037690.01350.03221323EURCNY0.00173010.03180.04159424GBPCNY0.000526410.01630.02294325CADCNY0.00454050.05360.06738326AUDCNY0.002556960.04030.05056627JPYCNY0.002556960.03490.04235628CHFCNY0.03163330.17280.177857


## 5. Empirical Results of Exchange Portfolio Based on Deep Learning

Based on deep learning, the dual-objective measurement model of the exchange portfolio is realized by using the MATLAB platform. In the specific operation, this paper uses gamultiobj function included in the genetic algorithm and direct search toolbox to complete.The input data of this algorithm comes from the prediction results of the SAE-SVR integrated model output in the previous process. Because of the normalization pretreatment of data before training the model, it is necessary to restore the data before completing the algorithm. The restoration algorithm is as follows:(10)Si=Smax−ZiSmax−Smin.Zi represents the data after normalization pretreatment, Si represents the data after restoration, and the restored output dataset is obtained. This paper takes the Forex data of the 50 days before June 1, 2021, as an example, according to formulas (11) and (12) of the dual-objective econometric model of Forex portfolio designed in this paper:(11)maxERx=∑i=1NxiRi,(12)minVRx=∑i=1NxistdRi,(13)s.t.∑i=1Nxi=1,xi≥0,i=1,2,…,N,N=28.Based on MATLAB, the NSGA-II exchange portfolio double objective measurement optimization algorithm is realized, and the optimal portfolio solution with 28 currency pairs as investment targets is calculated. In order to approach Pareto point more accurately and quickly, this paper first considers that 13 currency pairs with negative return rates are cut. Only the remaining 15 currency pairs are counted.The Pareto points obtained from the experimental results are shown in Figure9. This paper verifies the different results of the algorithm under different iterations. The repeated experimental results show that the algorithm has the highest expected rate of return and the lowest investment risk under 150 iterations. Table 2 shows nine investment portfolio schemes under 150 iterations; the order of the expected return is from large to small:Figure 9
Model Pareto points set for different iterations. (a) 50 iterations. (b) 100 iterations. (c) 150 iterations. (d) 200 iterations. (e) 300 iterations.
(a)(b)(c)(d)(e)Table 2
Forex portfolio scenarios based on NSGA-II algorithms.
Portfolio optionsEURUSDGBPUSDAUDUSDEURGBPUSDCADEURCADGBPCADAUDCADEURAUDGBPAUD1003.75%00000002003.59%00000003003.36%00000004003.34%00000005003.25%00000006003.08%00000007002.85%00000008002.80%00000009002.76%0000000Portfolio optionsUSDJPYEURJPYGBPJPYCADJPYAUDJPYUSDCHFEURCHFGBPCHFCADCHFAUDCHF15.15%0.01%0.28%78.50%0.52%3.63%00.87%1.85%0.20%26.32%0.07%0.28%69.01%0.73%3.77%01.26%1.65%0.25%37.66%0.18%0.25%54.07%4.75%3.93%01.87%1.34%0.32%47.82%0.19%0.25%52.90%4.68%3.95%01.92%1.31%0.33%57.31%0.21%0.27%49.77%0.97%4.05%02.08%1.22%0.33%66.70%0.26%0.25%39.07%1.04%4.20%02.53%0.96%0.36%711.79%0.41%0.25%27.71%1.26%4.34%02.97%0.84%0.48%811.04%0.41%0.24%22.68%5.27%4.38%03.27%0.67%0.48%912.13%0.44%0.26%22.63%1.33%4.43%03.18%0.73%0.50%Portfolio optionsCHFJPYUSDCNYEURCNYGBPCNYCADCNYAUDCNYJPYCNYCHFCNYER(X)SD(X)10.16%02.23%1.85%0.53%0.57%000.0161460.00908820.24%02.26%2.62%7.35%0.70%000.0149670.00860530.43%02.37%3.45%15.21%0.90%000.0135320.00807140.44%02.37%3.55%16.12%0.92%000.0133750.00800550.40%02.32%3.84%23.09%0.97%000.0123560.00759060.46%02.34%3.70%34.03%1.10%000.0107080.00699570.67%02.40%6.37%36.42%1.27%000.0098640.00649180.71%02.47%5.97%38.32%1.34%000.0095430.00645590.67%02.41%6.86%40.33%1.34%000.0091900.006224It can be seen from the experimental results that the proportion of exchange asset investment with negative forecast return is 0, which is in line with the actual requirements. According to the results of the portfolio, different investors can choose the corresponding portfolio according to their own characteristics. For risk averse investors, option 9 can be chosen. Although the expected rate of return is only 0.919%, the risk is relatively low, only 0.006224. On the contrary, for investors who have higher requirements for return and can bear certain risks, option 1 can be selected. At this time, the expected return rate is 1.6%, but the risk is also relatively high, and they have to bear 0.009088. Compared with the solution of linear programming, the expected rate of return has been improved and the diversity of investment is also reduced, so the quality of portfolio has been significantly improved. It has a good reference value in the practical operation of investors.


### 5.1. Experimental Results and Comparisons

The experiment summarizes the exchange rate prediction results based on the deep learning algorithm. Through the comparison in Table3, it can be seen that the MSE prediction accuracy of the deep learning algorithm can reach four digits after the decimal point, while the MSE prediction accuracy of the SVR algorithm can only reach three digits after the decimal point. It can be seen that the performance of the deep learning algorithm in exchange rate prediction is obviously better than the SVR algorithm. In this paper, the lifting value of SAE-SVR compared with deep learning algorithm is defined as follows:(14)promoted=|SAESVRMSE−ANNMSE|ANNMSE|.Table 3
Comparison of the summary results of the three models.
DatasetsDeep leaning MSESVR MSESAE-SVR MSEPromoted (%)Deep learning MAESVR MAESAE-SVR MAEPromoted (%)1EURUSD2.7307e − 040.00260982.88E−04−5.600.01220.03990.02234−83.112GBPUSD6.8046e − 040.00115286.09E−0410.510.01930.02720.0116939.433AUDUSD2.3025e − 040.00031451.95E − 0415.220.01130.01430.0101210.444EURGBP2.6657e − 040.00151292.51E − 045.720.01220.03070.011495.825USDCAD1.3537e − 040.00223631.82E − 04−34.150.00850.03320.00922−8.476EURCAD2.9867e − 040.00057571.44E − 0451.940.01260.01890.0098421.907GBPCAD2.2838e − 040.00079862.40E − 04−5.000.01670.02150.01808−8.268AUDCAD4.8400e − 040.000680211.57E − 0467.650.01670.01980.0108934.799EURAUD1.3568e − 040.000249624.12E − 0569.660.00840.01140.0051338.9310GBPAUD2.1326e − 040.000622552.77E − 04−29.730.01090.01910.01465−34.4011USDJPY1.4181e − 040.004653982.12E − 04−49.770.00880.05670.01577−79.2012EURJPY2.7442e − 040.000344667.06E − 0574.290.01200.01420.0065545.4213GBPJPY1.9389e − 040.001412369.14E − 0558.260.12990.02990.008293.6914CADJPY4.2757e − 040.000553661.70E − 0460.210.01490.01770.0093936.9815AUDJPY3.6397e − 040.00029195.06E − 0586.110.01360.01290.008934.5616USDCHF2.8011e − 040.00096693.42E − 0587.800.01010.01540.0078821.9817EURCHF1.9228e − 040.00225577.01E − 0563.560.00610.03040.004919.6718GBPCHF3.0714e − 040.00105269.99E − 0567.460.01030.01550.0054147.4819CADCHF2.9759e − 040.001114764.82E − 0583.810.01070.02080.009788.6020AUDCHF4.1407e − 040.00159799.80E − 0576.330.01290.02680.011815.4521CHFJPY2.2217e − 040.00144234.14E − 0581.350.00860.02240.008352.9122USDCNY8.7996e − 050.001037693.11E − 04−253.220.00610.01350.0099−62.3023EURCNY2.2732e − 040.00173012.94E − 04−29.220.01100.03180.01578−43.4524GBPCNY4.5092e − 040.000526411.68E − 0462.790.01490.01630.0111425.2325CADCNY1.7722e − 040.00454053.20E − 04−80.780.00970.05360.01675−72.6826AUDCNY2.3929e − 040.002556963.63E − 4−51.880.01180.04030.01772−50.1727JPYCNY1.9699e − 040.002556961.32E − 0433.100.00990.03490.0008691.3128CHFCNY0.01870.03163331.92E − 0599.900.08860.17280.0043895.06Sum———610.92———240.61According to the calculation results of the lifting column, the lifting values of 28 currency pairs are negative except for euro against US dollar, 5usdcad, 7gbpcad, 10gbpaud, 11usdjpy, 22usdcny, 23eurcny, 25cadcny, and 26audcny; that is, the prediction results of deep learning algorithm are better than the SAE-SVR algorithm proposed in this paper, and the lifting values of other 19 currencies are positive, which means that SAE-SVR algorithm has good prediction accuracy. The reason may be that too many datasets lead to certain errors, or the accuracy of the deep learning prediction algorithm proposed by this problem needs to be further improved, which will be gradually improved in future research. In this case, in order to further verify the prediction optimization degree of the SAE-SVR algorithm, add the promotion values of 28 currency pairs, and the total values of MSE and MAE are 610.92% and 240.61%, respectively. In other words, the SAE-SVR algorithm is 6 times higher than the deep learning algorithm in exchange rate prediction based on MSE. In short, the deep learning algorithm proposed in this paper has better performance than the traditional algorithm.


## 5.1. Experimental Results and Comparisons

The experiment summarizes the exchange rate prediction results based on the deep learning algorithm. Through the comparison in Table3, it can be seen that the MSE prediction accuracy of the deep learning algorithm can reach four digits after the decimal point, while the MSE prediction accuracy of the SVR algorithm can only reach three digits after the decimal point. It can be seen that the performance of the deep learning algorithm in exchange rate prediction is obviously better than the SVR algorithm. In this paper, the lifting value of SAE-SVR compared with deep learning algorithm is defined as follows:(14)promoted=|SAESVRMSE−ANNMSE|ANNMSE|.Table 3
Comparison of the summary results of the three models.
DatasetsDeep leaning MSESVR MSESAE-SVR MSEPromoted (%)Deep learning MAESVR MAESAE-SVR MAEPromoted (%)1EURUSD2.7307e − 040.00260982.88E−04−5.600.01220.03990.02234−83.112GBPUSD6.8046e − 040.00115286.09E−0410.510.01930.02720.0116939.433AUDUSD2.3025e − 040.00031451.95E − 0415.220.01130.01430.0101210.444EURGBP2.6657e − 040.00151292.51E − 045.720.01220.03070.011495.825USDCAD1.3537e − 040.00223631.82E − 04−34.150.00850.03320.00922−8.476EURCAD2.9867e − 040.00057571.44E − 0451.940.01260.01890.0098421.907GBPCAD2.2838e − 040.00079862.40E − 04−5.000.01670.02150.01808−8.268AUDCAD4.8400e − 040.000680211.57E − 0467.650.01670.01980.0108934.799EURAUD1.3568e − 040.000249624.12E − 0569.660.00840.01140.0051338.9310GBPAUD2.1326e − 040.000622552.77E − 04−29.730.01090.01910.01465−34.4011USDJPY1.4181e − 040.004653982.12E − 04−49.770.00880.05670.01577−79.2012EURJPY2.7442e − 040.000344667.06E − 0574.290.01200.01420.0065545.4213GBPJPY1.9389e − 040.001412369.14E − 0558.260.12990.02990.008293.6914CADJPY4.2757e − 040.000553661.70E − 0460.210.01490.01770.0093936.9815AUDJPY3.6397e − 040.00029195.06E − 0586.110.01360.01290.008934.5616USDCHF2.8011e − 040.00096693.42E − 0587.800.01010.01540.0078821.9817EURCHF1.9228e − 040.00225577.01E − 0563.560.00610.03040.004919.6718GBPCHF3.0714e − 040.00105269.99E − 0567.460.01030.01550.0054147.4819CADCHF2.9759e − 040.001114764.82E − 0583.810.01070.02080.009788.6020AUDCHF4.1407e − 040.00159799.80E − 0576.330.01290.02680.011815.4521CHFJPY2.2217e − 040.00144234.14E − 0581.350.00860.02240.008352.9122USDCNY8.7996e − 050.001037693.11E − 04−253.220.00610.01350.0099−62.3023EURCNY2.2732e − 040.00173012.94E − 04−29.220.01100.03180.01578−43.4524GBPCNY4.5092e − 040.000526411.68E − 0462.790.01490.01630.0111425.2325CADCNY1.7722e − 040.00454053.20E − 04−80.780.00970.05360.01675−72.6826AUDCNY2.3929e − 040.002556963.63E − 4−51.880.01180.04030.01772−50.1727JPYCNY1.9699e − 040.002556961.32E − 0433.100.00990.03490.0008691.3128CHFCNY0.01870.03163331.92E − 0599.900.08860.17280.0043895.06Sum———610.92———240.61According to the calculation results of the lifting column, the lifting values of 28 currency pairs are negative except for euro against US dollar, 5usdcad, 7gbpcad, 10gbpaud, 11usdjpy, 22usdcny, 23eurcny, 25cadcny, and 26audcny; that is, the prediction results of deep learning algorithm are better than the SAE-SVR algorithm proposed in this paper, and the lifting values of other 19 currencies are positive, which means that SAE-SVR algorithm has good prediction accuracy. The reason may be that too many datasets lead to certain errors, or the accuracy of the deep learning prediction algorithm proposed by this problem needs to be further improved, which will be gradually improved in future research. In this case, in order to further verify the prediction optimization degree of the SAE-SVR algorithm, add the promotion values of 28 currency pairs, and the total values of MSE and MAE are 610.92% and 240.61%, respectively. In other words, the SAE-SVR algorithm is 6 times higher than the deep learning algorithm in exchange rate prediction based on MSE. In short, the deep learning algorithm proposed in this paper has better performance than the traditional algorithm.


## 6. Conclusion

Deep learning uses the current cell data and the point-by-point product calculation method for learning. Its structure can be achieved through simple units. Form superposition construction, while using the jump connection method to prevent overfitting and the disappearance of gradient problems, significantly improving the learning speed and prediction accuracy of the deep network. Specifically, the two core algorithms proposed in the model, SVR exchange rate forecasting algorithm based on deep learning of stacked autoencoders, achieve more accurate results than the neural network and support vector machine. The dual-objective econometric optimization algorithm based on NSGA-II further applies the prediction results of the SAE-SVR integrated model to portfolio selection optimization and finally gives investors a more reasonable portfolio plan. Investors can operate in the market directly according to the results of this algorithm by using appropriate exchange derivatives tools. In terms of data selection, this paper uses the effective historical data of Metatrader4 real exchange trading platform and the direct safe exchange rate to currency provided by SAFE and selects a total of 52223 real data of 28 currency pairs from March 23, 2009, to February 1, 2016. This paper uses the MATLAB R2015a experimental platform under the 32-bit Windows 7 operating system. Finally, the innovation model proposed in this paper is realized by self-programming, and the ideal results are achieved. On the one hand, this paper can try more algorithms in deep learning. In addition to stack autoencoders, the typical algorithms of deep learning also include deep belief networks and convolutional neural network. In the next step, we should combine these two deep learning algorithms to do more research and empirical research on exchange forecasting algorithms. On the other hand, this paper only studies the technical aspects of exchange rate analysis, but the analysis of fundamentals is only limited to the carding and elaboration of the influencing factors of macro fundamentals, but there is no further research on the effect of the correlation of the influencing factors. This point can also be used as the next research direction of this paper.



---

*Source: 2993870-2021-09-22.xml*