Evolutionary algorithms consist of several heuristics able to solve optimization tasks by imitating some aspects of natural evolution. In the ﬁeld of computational ﬁnance, this type of procedures, combined with neural networks, swarm intelligence, fuzzy systems and machine learning has been successfully applied to a variety of problems, such as the prediction of stock price movements and the optimal allocation of funds in a portfolio. Nowadays, there is an increasing interest among computer scientists to solve these issues concurrently by deﬁning automatic trading strategies based on artiﬁcial expert systems, technical analysis and fundamental and economic information. The objective is to develop procedures able, from one hand, to mimic the practitioners behavior and, from the other, to beat the market. In this sense, Fernandez-Rodríguez et al. (2005) investigate the proﬁtability of the generalized moving average trading rule for the General Index of Madrid Stock Market by optimizing parameter values with a genetic algorithm. They conclude that the optimized trading rules are superior to a risk-adjusted buy-and-hold strategy if the transaction costs are reasonable. Similarly, Papadamou & Stephanides (2007) present the GATradeTool, a parameter optimization tool based on genetic algorithms for technical trading rules. In the description of this software, they compare it with other commonly used, non-adaptive tools in terms of stability of the returns and computational costs. Results of the tests on the historical data of a UBS fund show that GATradeTool outperforms the other tools. Fernández-Blanco et al. (2008) propose to use the moving average convergence divergence technical indicator to predict stock indices by optimizing its parameters with a genetic algorithm. Experimental results for the Dow Jones Industrial Average index conﬁrm the capability of evolutionary algorithms to improve technical indicators with respect to the classical conﬁgurations adopted by practitioners. An alternative approach to generate technical trading systems for stock timing that combines machine learning paradigms and a variable length string multi-objective genetic algorithm is proposed in Kaucic (2010). The most informative technical indicators are selected by the genetic algorithm and combined into a unique trading signal by a learning method. A static single-position automated day trading strategy between the S&P 500 Composite Index and the 3-months Treasury Bill is analyzed in three market phases, up-trend, down-trend and sideways-movements, covering the period 2000-2006. The results indicate that the near-optimal set of rules varies among market phases but presents stable results and is able to reduce or eliminate losses in down-trend periods. As a natural consequence of these studies, evolutionary algorithms may constitute a promising tool also for portfolio strategies involving more than two stocks. In the ﬁeld of portfolio selection, Markowitz and Sharpe models are frequently used as a task for genetic algorithm optimization. For instance, the problem of ﬁnding the efﬁcient frontier associated with the standard mean-variance portfolio is tackled by Chang et al. (2000). They extend the standard model to include cardinality and composition constraints by applying three heuristic algorithms based upon genetic algorithms, tabu search and simulated annealing. Computational results are presented for ﬁve data sets involving up to 225 assets. Wilding (2003) proposes a hybrid procedure for portfolio management based on factor models, allowing constraints on the number of trades and securities. A genetic algorithm is responsible for selecting the best subset of securities that appears in the ﬁnal solution, while a quadratic programming routine determines the utility value for that subset. Experiments show the ability of this approach to generate portfolios highly able to track an index. The β − G genetic portfolio algorithm proposed by Oh et al. (2006) selects stocks based on their market capitalization and optimizes their weights in terms of portfolio β’s standard deviation. The performance of this procedure depends on market volatility and tends to register outstanding performance for short-term applications. The approach I consider for portfolio management is quite different from the previous models and is based on technical analysis. In general, portfolio optimizations using technical analysis are modular procedures where a module employs a set of rules based on technical indicators in order to classify the assets in the market, while another module concentrates on generating and managing portfolio over time (for a detailed presentation of the subject, the interested reader may refer to Jasemi et al. (2011)). An interesting application in this context is the approach developed by Korczak & Lipinski (2003) that leads to the optimization of portfolio structures by making use of artiﬁcial trading experts, previously discovered by a genetic algorithm (see Korczak & Roger (2002)), and evolutionary strategies. The approach has been tested using data from the Paris Stock Exchange. The proﬁts obtained by this algorithm are higher than those of the buy-and-hold strategy. Recently, Ghandar et al. (2009) describe a two-modules interacting procedure where a genetic algorithm optimizes a set of fuzzy technical trading rules according to market conditions and interacts with a portfolio strategy based on stock ranking and cardinality constraints. They introduce several performance metrics to compare their portfolios with the Australian Stock Exchange index, showing greater returns and lower volatility. An alternative multi-modular approach has been developed by Gorgulho et al. (2011) that aims to manage a ﬁnancial portfolio by using technical analysis indicators optimized by a genetic algorithm. In order to validate the solutions, authors compare the designed strategy against the market itself, the buy-and-hold and a purely random strategy, under distinct market conditions. The results are promising since the approach outperforms the competitors. As the previous examples demonstrate, the technical module occupies, in general, a subordinate position relative to the management component. Since transaction costs, cardinality and composition constraints are of primary importance for the rebalancing purpose, the effective impact of technical signals in the development of optimal portfolios is not clear. To highlight the beneﬁts of using technical analysis in portfolio management, I propose an alternative genetic optimization heuristic, based on an equally weighted zero investment strategy, where funds are equally divided among the stocks of a long portfolio and the stocks of a short one. Doing so, the trading signals directly inﬂuence the portfolio construction. Moreover, I implement three types of portfolio generation models according to the risk-adjusted measure considered as the objective, in order to study the relation between portfolio risk and market condition changes. The remainder of the chapter is organized as follows. Section 2 explains in detail the proposed method, focusing on the investment strategy, the deﬁnitions of the technical indicators and the evolutionary learning algorithm adopted. Section 3 presents the experimental results and discussions. Finally, Section 4 concludes the chapter with some remarks and ideas for future improvements.

### Portfolio Management Using Artificial Trading Systems Based on Technical Analysis

#####
*KAUCIC, MASSIMILIANO*

##### 2012

#### Abstract

Evolutionary algorithms consist of several heuristics able to solve optimization tasks by imitating some aspects of natural evolution. In the ﬁeld of computational ﬁnance, this type of procedures, combined with neural networks, swarm intelligence, fuzzy systems and machine learning has been successfully applied to a variety of problems, such as the prediction of stock price movements and the optimal allocation of funds in a portfolio. Nowadays, there is an increasing interest among computer scientists to solve these issues concurrently by deﬁning automatic trading strategies based on artiﬁcial expert systems, technical analysis and fundamental and economic information. The objective is to develop procedures able, from one hand, to mimic the practitioners behavior and, from the other, to beat the market. In this sense, Fernandez-Rodríguez et al. (2005) investigate the proﬁtability of the generalized moving average trading rule for the General Index of Madrid Stock Market by optimizing parameter values with a genetic algorithm. They conclude that the optimized trading rules are superior to a risk-adjusted buy-and-hold strategy if the transaction costs are reasonable. Similarly, Papadamou & Stephanides (2007) present the GATradeTool, a parameter optimization tool based on genetic algorithms for technical trading rules. In the description of this software, they compare it with other commonly used, non-adaptive tools in terms of stability of the returns and computational costs. Results of the tests on the historical data of a UBS fund show that GATradeTool outperforms the other tools. Fernández-Blanco et al. (2008) propose to use the moving average convergence divergence technical indicator to predict stock indices by optimizing its parameters with a genetic algorithm. Experimental results for the Dow Jones Industrial Average index conﬁrm the capability of evolutionary algorithms to improve technical indicators with respect to the classical conﬁgurations adopted by practitioners. An alternative approach to generate technical trading systems for stock timing that combines machine learning paradigms and a variable length string multi-objective genetic algorithm is proposed in Kaucic (2010). The most informative technical indicators are selected by the genetic algorithm and combined into a unique trading signal by a learning method. A static single-position automated day trading strategy between the S&P 500 Composite Index and the 3-months Treasury Bill is analyzed in three market phases, up-trend, down-trend and sideways-movements, covering the period 2000-2006. The results indicate that the near-optimal set of rules varies among market phases but presents stable results and is able to reduce or eliminate losses in down-trend periods. As a natural consequence of these studies, evolutionary algorithms may constitute a promising tool also for portfolio strategies involving more than two stocks. In the ﬁeld of portfolio selection, Markowitz and Sharpe models are frequently used as a task for genetic algorithm optimization. For instance, the problem of ﬁnding the efﬁcient frontier associated with the standard mean-variance portfolio is tackled by Chang et al. (2000). They extend the standard model to include cardinality and composition constraints by applying three heuristic algorithms based upon genetic algorithms, tabu search and simulated annealing. Computational results are presented for ﬁve data sets involving up to 225 assets. Wilding (2003) proposes a hybrid procedure for portfolio management based on factor models, allowing constraints on the number of trades and securities. A genetic algorithm is responsible for selecting the best subset of securities that appears in the ﬁnal solution, while a quadratic programming routine determines the utility value for that subset. Experiments show the ability of this approach to generate portfolios highly able to track an index. The β − G genetic portfolio algorithm proposed by Oh et al. (2006) selects stocks based on their market capitalization and optimizes their weights in terms of portfolio β’s standard deviation. The performance of this procedure depends on market volatility and tends to register outstanding performance for short-term applications. The approach I consider for portfolio management is quite different from the previous models and is based on technical analysis. In general, portfolio optimizations using technical analysis are modular procedures where a module employs a set of rules based on technical indicators in order to classify the assets in the market, while another module concentrates on generating and managing portfolio over time (for a detailed presentation of the subject, the interested reader may refer to Jasemi et al. (2011)). An interesting application in this context is the approach developed by Korczak & Lipinski (2003) that leads to the optimization of portfolio structures by making use of artiﬁcial trading experts, previously discovered by a genetic algorithm (see Korczak & Roger (2002)), and evolutionary strategies. The approach has been tested using data from the Paris Stock Exchange. The proﬁts obtained by this algorithm are higher than those of the buy-and-hold strategy. Recently, Ghandar et al. (2009) describe a two-modules interacting procedure where a genetic algorithm optimizes a set of fuzzy technical trading rules according to market conditions and interacts with a portfolio strategy based on stock ranking and cardinality constraints. They introduce several performance metrics to compare their portfolios with the Australian Stock Exchange index, showing greater returns and lower volatility. An alternative multi-modular approach has been developed by Gorgulho et al. (2011) that aims to manage a ﬁnancial portfolio by using technical analysis indicators optimized by a genetic algorithm. In order to validate the solutions, authors compare the designed strategy against the market itself, the buy-and-hold and a purely random strategy, under distinct market conditions. The results are promising since the approach outperforms the competitors. As the previous examples demonstrate, the technical module occupies, in general, a subordinate position relative to the management component. Since transaction costs, cardinality and composition constraints are of primary importance for the rebalancing purpose, the effective impact of technical signals in the development of optimal portfolios is not clear. To highlight the beneﬁts of using technical analysis in portfolio management, I propose an alternative genetic optimization heuristic, based on an equally weighted zero investment strategy, where funds are equally divided among the stocks of a long portfolio and the stocks of a short one. Doing so, the trading signals directly inﬂuence the portfolio construction. Moreover, I implement three types of portfolio generation models according to the risk-adjusted measure considered as the objective, in order to study the relation between portfolio risk and market condition changes. The remainder of the chapter is organized as follows. Section 2 explains in detail the proposed method, focusing on the investment strategy, the deﬁnitions of the technical indicators and the evolutionary learning algorithm adopted. Section 3 presents the experimental results and discussions. Finally, Section 4 concludes the chapter with some remarks and ideas for future improvements.I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.