# Multi-objective optimization case study for algorithmic trading strategies in foreign exchange markets

- 96 Downloads

## Abstract

This research focuses on a case study of two approaches for producing algorithmic trading rules in foreign exchange markets using genetic algorithms: multi-objective optimization and spontaneous optimization of design variables. First, while conventional trading systems explore a single-objective function such as the Sharpe ratio or only profit, multi-objective optimization allows us to manage the essential trade-off among profit, standard deviation, and maximum-drop. Our approach improves present trading systems, thus avoiding the possibility of substantial losses and, in addition, it can increase investment profits. Second, design parameters such as trading volume, the amount of historical data, and trading gateways of technical indicators are continuously optimized in real time, in contrast, to traditional trading algorithms that have mostly relied on a few prefixed values for the design variables in an optimization problem. Incorporating these research approaches into a genetic algorithm methodology will improve the robustness of results.

## Keywords

Multi-objective optimization Trading strategies Foreign exchange markets Genetic algorithm## JEL classification

G110 C600 C610 C630## 1 Introduction

High-frequency foreign exchange trading strategies have been the focus of much effort in recent years by both traders and researchers. Fundamental analysis, as it relates to foreign exchange trading, requires that many global and macroeconomic factors be taken into account. To incorporate this wide array of influences into algorithmic trading schemes would be a difficult task. Furthermore, because fundamental factors do not vary significantly over the short time horizons used in algorithmic trading, the task of developing algorithmic trading rules seems to lend itself naturally to technical analysis approaches. On the other hand, technical analysis is the practice by traders of using statistical indicators based on historical price and volume data to identify current price trends, price trend reversals, and other market conditions, and thereby predict future price movements.

- 1.
Can we address the importance of multi-objective strategies in algorithmic foreign exchange trading on the continuous time horizon?

- 2.
Can design variables such as trading volume, the time horizon for historical data used, and trading gateways of technical indicators be optimized in real time?

- 3.
How can multi-objective optimization theory be used to provide trading strategies, while showing trade-off relationships among objective functions?

Much research effort into the development of foreign exchange trading strategies has focused on machine learning. Dempster and Jones (2001) used a genetic programming (GP) system to produce trading rules for US Dollar/British Pound intraday spot data, where genetic algorithms require that string length to be fixed (i.e., the number of technical indicators used in all generations of trading rules be the same), genetic programming, by allowing trading rules to vary in length, can probe the solution space more efficiently. For their single-objective function, they used a modified Sterling ratio.

Dunis et al. (1999) used GA to develop trading systems containing two models, a signal model and a position model. The signal model is based on momentum trend indicators and produces price predictions. The position model then generates a trading rule based on comparing the current market price to the predicted price, given the trader’s current position. Initially, the authors used profit as the only fitness criteria. They also develop a “performance index” consisting of (a) the fraction of positions which were profitable; (b) a pessimism ratio; (c) the Sharpe ratio; (d) the annualized cumulative gain; and (e) the 5% probability of ruin. However, the authors did not incorporate their index into a multi-objective GA system. Model results based on this index did not differ significantly from models optimized solely on profit.

Hirabayashi et al. (2009) applied GA to determine optimum market timing based on the best combination of technical indicators. The four technical indicators used were: (a) the relative strength index (RSI), (b) the percent difference from a moving average, (c) the rising/falling rate lagged by 1°h, and (d) an RSI based on an exponentially weighted moving average. Using three different conditional equations created by varying the Boolean operators connecting the indicators, the authors, in effect, varied the length of the strings by which technical indicators were “turned on” through the optimal conditional equation.

Using 10-min time intervals to measure price change and eight different technical indicators, Myszkowski and Bicz (2010) applied GA to generate trading strategies on the EUR/USD currency pair. Using the data from May 2007 to January 2010, they identified time periods of approximately equal lengths, during which the exchange rate for the USD was either falling or rising, or showing no discernible trend. GA was used to find optimal values for maximum tree height or string length, transaction costs, probability of mutation, and probability of crossover. The authors used a single fitness function which consisted of the sum of all profits divided by the sum of all losses and transaction costs.

Zhang and Ren (2010) also used GA to develop trading strategies based on the GBP/USD currency pair, experimenting with ten different technical indicators and incorporating a neutral position trading rule (i.e., the trader neither buys nor sells) into their strategies. For their objective function, they used the Sterling ratio as their single performance criterion.

While most GA research efforts into the development of foreign exchange trading rules, including the ones cited above, use only one objective or fitness function, many real-world problems require the consideration of multiple and conflicting goals. In finance, the classic trade-off is between risk and return. This trade-off is measured in many forms in the literature such as value-at-risk (VaR), the Sharpe ratio, maximum loss, the winning ratio, and chance of ruin. The portfolio optimization theory, suggested by Markowitz (1952), embodies the minimized portfolio variance with a restriction that the portfolio’s weights sum to 1 at a given mean return. Current trading algorithms in academia and industry mainly count on the Sharpe ratio (Return/Risk) that originated from an investment’s return and risk. Consequently, the use of Sharpe ratio in trading algorithms often results in a single-objective optimization viewpoint. Our research paper will address properly conflicting financial goals in foreign exchange trading, while using a genetic algorithm methodology with multi-objective functions.

There are many examples in the literature of problems which incorporate multiple objectives. For example, in developing multi-objective optimization algorithms, Deb et al. (2002) proposed multi-objective evolutionary algorithms (EAs) that use non-dominated sorting and sharing methods. They named the algorithm “non-dominated sorting genetic algorithm II (NSGA-II).” The algorithm is able to find a better spread of solutions and has better convergence properties near the true Pareto optimal frontier in most benchmark tests. It is considered an improved version of NSGA, which originated in 1995 (Srinivas and Deb 1995). The fundamental concept for non-dominated sorting is a ranking selection method, which finds good points in the design pool for maintaining sub-populations of these good points. The main issues in GA algorithms are the high computational load and unexpected local optima. Deb et al. (2002) updated the algorithm (NSGA-II) using a fast non-dominated sorting procedure, an elitist-preserving approach, and a parameter-less niching operator.

In finance applications of multi-objective optimization, many research articles propose unique academic methods. Babaei et al. (2015) formulate the portfolio optimization problem as a multi-objective mixed integer programming problem. For this research, they used Value-at-Risk (VaR) as a risk measure. With their research framework, they tried to shed light on the dependence structure among the financial returns along with the fat-tailed distribution. Another instance of multi-objective optimization in finance, Lwin et al. (2017) suggested an alternative to Markowitz’s mean–variance model in which the variance is replaced with an industry standard risk measure, Value-at-Risk (VaR), for the assessment of market risk exposure, which is closely associated with fluctuated financial data. This research tries to minimize the computational load to a non-convex NP-hard problem which is computationally intractable.

## 2 Methodology

### 2.1 Multi-objective optimization

*x*is a vector of design variables (i.e., a point in the design space) and where \(X\) represents a feasible design space defined by constraints (Deb 2005; Miettinen 2008; Miettinen et al. 2008; Srinivas and Deb 1994).

The following sequence of definitions formally defines the solution set, i.e., the Pareto optimal set of points.

### Definition 1

Given two vectors *x* and *y*\(\in R^{k}\)*, x* dominates *y* if *x *≤ *y*, for all elements of the vector.

### Definition 2

A vector of design variables \(x \in X \subset R^{k}\) is non-dominated in regards to \(X\), if there does not exist another \(x^{\prime} \in X,\) such that \(x^{\prime}\) dominates \(x\).

### Definition 3

If \(X\) is non-dominated, the vector of design variables \(x \in X \subset R^{k}\) is a Pareto optimal solution.

### Definition 4

### 2.2 Genetic algorithms

Genetic algorithms use the principle of “survival of the fittest” to find solutions to optimization problems (Goldberg 1989). The genetic algorithm (GA) approach is an artificial search technique that borrows from biology the processes of inheritance, selection, crossover, and mutation, to repeatedly search for better and better solutions. While truly perfect optimization is not guaranteed with GA, near perfect solutions to hard problems in the real world are often the best that can be achieved. One reason that genetic algorithms are efficient techniques for searching difficult solution spaces is that they are population-based algorithms. Instead of the researcher testing one possible solution after another, each generation generated according to the GA algorithm typically includes many potential solutions that are an improvement over prior generations. This large sampling technique allows GA to move more quickly to an optimal solution.

To implement the selection process, potential solutions must be translated into binary strings of finite length. These strings are then scored against a fitness function, so that optimization can be achieved. To initialize the GA algorithm, an initial generation of potential solutions is generated randomly. These solutions are then evaluated against the objective function and ranked according to their fitness values. The second generation is then subjected to the genetic operator called crossover. Crossover occurs when strings in this second generation are paired randomly, after which both strings in each pair are broken at a randomly determined point. The strings of the pair, which stand for design variables, are then swapped, thereby exchanging their genetic information and creating new solutions. Some information may be lost through this crossover mechanism, however. Mutation in GAs helps guard against this through random alterations with small probability, and thus is a random attempt to replace potentially valuable genetic information that was lost prematurely. The GA procedure can be summarized as follows:

*Step 1* (Initialization): randomly initialized population of solutions are generated and the objective functions are evaluated.

*Step 2* (Selection): during each successive generation, a portion of the existing population is selected to be passed on to the new generation. Individual solutions are selected based on assessment of objective functions.

*Step 3* (Crossover): combining parents from existing population to produce the next generation. Using crossover, new solutions in the feasible design space are searched.

*Step 4* (Mutation): mutation happens with small probability and it helps prevent premature local optimum.

*Step 5* (Loop): go to step 2.

### 2.3 Non-dominated sorting genetic algorithm II (NSGA-II)

The GA algorithm used in this research is non-dominated sorting genetic algorithm II (NSGA-II) (Deb et al. 2002). This GA algorithm is the updated version of NSGA (Srinivas and Deb 1995) using a fast non-dominated sorting procedure, an elitist-preserving approach, and a parameter-less niching operator. In GA algorithms for single and multi-objective optimizations, both high computational load and local optima are still on-going issues that need to be addressed. In regards to existing problems, NSGA-II shows relatively better performance and has been widely used since its development. In particular, in multi-objective optimization, non-dominated Pareto solutions are well searched by NSGA-II, while saving and minimizing simulation time.

### 2.4 Technical indicators for trading

There are various technical indicators in the market and they were developed to detect the market trend. Since most trading indicators include similar components and show high correlations among them, this paper adopts the four most popular indicators (Chan 2008; Gencay et al. 2001; Kestner 2003). The technical indicators we use are the price oscillator (PO), relative strength index (RSI), stochastic oscillator (SC), and rate of change (ROC). The details for these technical indicators are provided in the “Appendix”.

## 3 Data and simulation setting

### 3.1 Sample data

Descriptive statistics of JPY/USD

(a) Currency exchange rate | |

Mean | 94.342 |

Standard deviation | 1.516 |

Kurtosis | − 1.047 |

Skewness | 0.754 |

Minimum | 92.604 |

Maximum | 97.811 |

(b) Log return | |

Mean | 0.000005 |

Standard deviation | 0.000234 |

Kurtosis | 17.158846 |

Skewness | 0.496420 |

Minimum | − 0.002275 |

Maximum | 0.003310 |

Descriptive statistics of EUR/USD

(a) Currency exchange rate | |

Mean | 1.286 |

Standard deviation | 0.006 |

Kurtosis | 0.752 |

Skewness | 1.220 |

Minimum | 1.275 |

Maximum | 1.304 |

(b) Log return | |

Mean | 0.000002 |

Standard deviation | 0.000144 |

Kurtosis | 60.067666 |

Skewness | 2.019762 |

Minimum | − 0.002181 |

Maximum | 0.003290 |

Descriptive statistics of EUR/JPY

(a) Currency exchange rate | |

Mean | 121.341 |

Standard deviation | 2.407 |

Kurtosis | − 0.584 |

Skewness | 0.985 |

Minimum | 119.103 |

Maximum | 127.253 |

(b) Log return | |

Mean | 0.000008 |

Standard deviation | 0.000265 |

Kurtosis | 9.644824 |

Skewness | 0.408360 |

Minimum | − 0.002144 |

Maximum | 0.003137 |

### 3.2 Simulation settings

#### 3.2.1 Genetic algorithm

Settings for genetic algorithm

Size of population | 20 |

Number of generations | 10 |

Rate of crossover | 0.8 |

Rate of mutation | 0.1 |

#### 3.2.2 Technical indicators

Technical indicators and GA

Technical indicators for trading | GA selection | Upper for sell | Down for buy |
---|---|---|---|

Percentage of price oscillator (PPO) | 20–30 | 20–30 | − 20 to − 30 |

Relative strength index (RSI) | 20–30 | 80–70 | 20 to − 30 |

Stochastic oscillator (SC) | 20–30 | 20–30 | − 20 to − 30 |

Rate of change (ROC) | 2–20 | 2–20 | − 2 to − 20 |

Technical indicators and Boolean operators

Indicator | Boolean | Indicator | Boolean | Indicator | Boolean | Indicator | Boolean |
---|---|---|---|---|---|---|---|

PPO | And/Or | RSI | And/Or | SC | And/Or | ROC | And/Or |

5-digit | 0/1 | 5-digit | 0/1 | 5-digit | 0/1 | 5-digit | 0/1 |

#### 3.2.3 Historical data and trading volume

In this work, the genetic algorithm optimizes the trading volume and the length of historical data used in calculating the technical indicators. Namely, this is because the recommended numerical values do not take into consideration the rapidly changing trading market. For the historical data used, the range of 1–20 time ticks is considered and the range of 1–20 for the trading volume is allowed as design variables for the genetic algorithm.

#### 3.2.4 Objective functions

Three objective functions are employed: logarithmic profit, profit deviation, and maximum drop of the profit. The deviation and maximum drop are selected to observe a trade-off relationship with the profit. The profit deviation and maximum drop functions were selected to investigate their usefulness as risk management factors. As a benchmark test, a traditional index, the Sharpe Ratio is investigated with a single objective, genetic algorithm, to emphasize the necessity of multi-objective optimization in the trading algorithm. The transaction cost is set to 0.15%.

## 4 Simulation results

To demonstrate the necessity of multi-objective optimization, this paper provides three results for each preference of objective functions. For the simultaneous multi-optimization of algorithmic trading, we adopt a decision-making attitude for the next transaction, calling it a strategy or preference selection. Naturally, the accumulated profits will be different depending on the selected preference. To illustrate, a risk-taker considers profit critical, while a risk-adverse person will focus on risk management. As another example, some investors might change their position strategies from risk-adverse to risk-taking during trading hours. Such situations all demonstrate the importance of multi-objective optimization.

*x*-axis) and Standard Deviation of Returns (on the

*y*-axis) that are attainable using our multi-objective optimization GA framework. Notice that the points form a Pareto optimal frontier. With these figures, we observe that non-dominated design points were successfully found using NSGA-II. The red point signifies the point on the frontier that attains the maximum profit. The figure also contains points that are Pareto dominated. The minus sign for the profit objective function is assigned since this relates to maximization, while other objective functions are being minimized. A risk-taking trader will select investment strategies generating the biggest profit such as trading position and trading volume. The results of this research clearly show the trade-off between profit and deviation. The deviation and maximum-drop, as objective functions, have a proportional relation. For the continuous simulation on the time axis, the red circles in Figs. 8, 9, 10 relate to profit maximization. In case of standard deviation and maximum-drop of the profit, the black circles will be selected.

The preference that calls for minimizing the maximum-drop of profits can be regarded as a stable strategy. The weakness of this preference is that the profit is not relatively low in the bullish market compared against that of the other two preferences. The preference of standard deviation among objective functions shows an intermediate trading performance. In the bearish market, this preference minimizes damage, while still increasing profit. Additionally, the main reason that the profit-preference shows the large fluctuation in profits is that this strategy uses a higher trading volume, when a bullish market is detected. The simulation results show that the users of multi-objective optimization need to minimize the range of trading volume or change preference once a bearish market is continuously detected. In contrast, if a continuous bullish market lasts, the preference should be changed. This paper intentionally does not change these important factors to demonstrate the framework of multi-objective optimization. Using decision theory to optimally change the preferences is not within the scope of this paper.

In the benchmark simulation with the single-objective function of the Sharpe ratio, the accumulated profit is less than the results of the profit-preference and better than the results of the other two objectives. This result indicates that the profit-preference objective function should be employed as a primary strategy in a bullish market and the other two objective functions should be used in a bearish market. Simultaneously, this shows that proper preference changes with multi-objective optimization in the trading frame will obtain higher profits.

## 5 Conclusions and suggestions for future work

This research verifies the importance of multi-objective optimization by providing a framework for traders and investors to use multi-objective optimization with an evolutionary algorithm. In particular, this work focuses on finding trade-off relations among the three objective functions, in contrast to typical trading methods in the market, which pursue only a single-objective function such as the Sharpe ratio or only profit. Consequently, these methods either expose a high-risk impact in the bearish market or cannot pursue high profits in the bullish market. In addition, the optimization approach described in this paper does not begin with a specific trading volume or length of historical data, but instead allows the genetic algorithm to select the optimized numerical values in the evolutionary process. The fundamental idea behind this approach is that prefixed numbers can be strong constraints in the optimization case study, shrinking the pool of candidate solutions and eliminating good potential optimum values, which the multi-objective optimization approach has identified.

- 1.
Employing other multi-objective optimization algorithms, not limited to NSGA-II.

- 2.
Comparing simulation results on multi-objective optimization algorithms versus weighted average methods for objective functions.

## Notes

### Acknowledgements

This research was performed purely for academic purpose by the author in his personal capacity and not as an employee of S&P Global Ratings. The views expressed herein are entirely the author’s own and are not those of, or expressed on behalf of, S&P Global Ratings or any of its affiliates.

## References

- Babaei, S., Sepehri, M. M., & Babaei, E. (2015). Multi-objective portfolio optimization considering the dependence structure of asset returns.
*European Journal of Operational Research,**244*(2), 525–539.CrossRefGoogle Scholar - Chan, E. (2008).
*Quantitative trading: How to build your own algorithmic trading business*. Hoboken: Wiley.Google Scholar - Deb, K. (2005). Multi-Objective Optimization. In E. K. Burke & G. Kendall (Eds.),
*Search methodologies: introductory tutorials in optimization and decision support techniques*(1st ed., pp. 273–316). NY: Springer Science + Business Media.CrossRefGoogle Scholar - Deb, K., Pratap, A., Agarwal, S., & Meyarivan, T. (2002). A fast and elitist multiobjective genetic algorithm: NSGA-II.
*IEEE Transactions on Evolutionary Computation,**6*(2), 182–197.CrossRefGoogle Scholar - Dempster, M. A. H., & Jones, C. M. (2001). A real-time adaptive trading system using genetic programming.
*Quantitative Finance,**1,*399–413.CrossRefGoogle Scholar - Dunis, C., Harris, A., Leong, S., & Nacaskul, P. (1999). Optimizing intraday trading models with genetic algorithms.
*Neural Network World,**9*(3), 193–233.Google Scholar - Gencay, R., Dacorogna, M., & Müller, U. (2001).
*An introduction to high-frequency finance*. San Diego: Academic Press.Google Scholar - Goldberg, D. (1989).
*Genetic Algorithms in Search, Optimization and Machine Learning*. Reading: Addison-Wesley Publishing Company.Google Scholar - Hirabayashi, A., Aranha, C., & Iba, H. (2009). Optimization of the trading rule in foreign exchange using genetic algorithm.
*Proceedings of the 11th Annual conference on Genetic and evolutionary computation, July 08*–*12, 2009*(pp. 1529–1536). New York: ACM Publishing.Google Scholar - Kestner, L. (2003).
*Quantitative trading strategies: harnessing the power of quantitative techniques to create a winning trading program*. NY: McGraw-Hill.Google Scholar - Lwin, K., Qu, R., & MacCarthy, B. (2017). Mean-VaR portfolio optimization: A nonparametric approach.
*European Journal of Operational Research,**260*(2), 751–766.CrossRefGoogle Scholar - Miettinen, K. (2008). Introduction to multiobjective optimization: noninteractive approaches.
*Lecture Notes in Computer Science,**5252,*1–16.CrossRefGoogle Scholar - Miettinen, K., Ruiz, F., & Wierzbicki, A. P. (2008). Introduction to multiobjective optimization: interactive approaches.
*Lecture Notes in Computer Science,**5252,*27–57.CrossRefGoogle Scholar - Myszkowski, P. B., & Bicz, A. (2010). Evolutionary algorithm in forex trade strategy generation.
*Proceedings of the International Multiconference on Computer Science and Information Technology,**5,*84–88.Google Scholar - Srinivas, N., & Deb, K. (1994). Multiobjective optimization using nondominated sorting in genetic algorithms.
*Evolutionary Computation,**2*(3), 221–248.CrossRefGoogle Scholar - Srinivas, N., & Deb, K. (1995). Multiobjective function optimization using nondominated sorting genetic algorithms.
*Evolutionary Computation,**2*(3), 221–248.CrossRefGoogle Scholar - Zhang, H., & Ren, R. (2010). High frequency foreign exchange trading strategies based on genetic algorithms.
*Second International Conference on Network Security, Wireless Communications and Trusted Computing,**2,*426–429.Google Scholar