Accepted Manuscript A Hybrid Approach to Portfolio Composition based on Fundamental and Technical Indicators António Silva, Rui Neves, Nuno Horta PII: DOI: Reference:
S0957-4174(14)00611-3 http://dx.doi.org/10.1016/j.eswa.2014.09.050 ESWA 9589
To appear in:
Expert Systems with Applications
Please cite this article as: Silva, A., Neves, R., Horta, N., A Hybrid Approach to Portfolio Composition based on Fundamental and Technical Indicators, Expert Systems with Applications (2014), doi: http://dx.doi.org/10.1016/ j.eswa.2014.09.050
This is a PDF file of an unedited manuscript that has been accepted for publication. As a service to our customers we are providing this early version of the manuscript. The manuscript will undergo copyediting, typesetting, and review of the resulting proof before it is published in its final form. Please note that during the production process errors may be discovered which could affect the content, and all legal disclaimers that apply to the journal pertain.
A Hybrid Approach to Portfolio Composition based on Fundamental and Technical Indicators António Silva
Rui Neves
Nuno Horta
Dep. Engineering and Management Instituto Superior Técnico Lisbon, Portugal
[email protected]
Instituto de Telecomunicações Instituto Superior Técnico Lisbon, Portugal
[email protected]
Instituto de Telecomunicações Instituto Superior Técnico Lisbon, Portugal
[email protected]
Abstract This paper describes a new approach to portfolio management using stocks. The investment models tested incorporate a fundamental and technical approach using financial ratios and technical indicators. A Multi-Objective Evolutionary Algorithms (MOEA) with two objectives, the return and the risk, are used to optimize the models. Three different chromosomes are used for representing different investment models with real constraints equivalent to the ones faced by portfolio managers. To validate the present solution three case studies are presented for the S&P 500 for the period June 2010 until 2014. Simulations demonstrate that the stock selection based on financial ratios can be used to choose the best companies in operational terms, obtaining returns above the market average with low variances in their returns. The increase of fundamental indicators enhances the quality of the chromosomes found by the MOEA, and the results of real simulations become more precise. Some of the best chromosomes found by the algorithms invest in stocks with high return on equity (ROE), in conjunction with high rate of growth of the net income and a high profit margin. To obtain stocks with high valuation potential, it is necessary to choose companies with a lower or average market capitalization, low PER, high rates of revenue growth and high operating leverage. Keywords Evolutionary algorithms, fundamental analysis, technical analysis, stock investments
1. Introduction There are several ways to invest in the stock market namely technical analysis, value investing and the random walk theory. Technical analysis studies the market patterns, the demand and supply of stocks shares (Achelis, 2000). Value investing studies the financial information of the industries sector where a company operates to find the intrinsic value of a stock. The random walk theory defends that the market discounts all future developments, so the investor cannot expect to outperform the general market (Murphy, 1999). Capital allocation is the set of investment decisions that an investor takes to divide his capital by a number of assets, to maximize the expected return and minimize the risk to solve the portfolio optimization problem. This is a complex problem, depending on the correlation of the assets, budget constraints and preferable industries by the investor. This type of problems are practically impossible to solve by deterministically techniques, which is why researchers developed heurists like local search (LS), Tabu Search (TS), Simulated Annealing (SA), Particle Swarm Optimization (PSO), Ant Colony Optimization (ACO), and Evolutionary Algorithms (EA) to solve them (Fonseca & Fleming, 1993). EA are based on the process of biologic evolution, where the solutions of the problem are encoded in chromosomes and evaluated using a fitness function to select the best candidates to generate new populations. The repeating of the process of evaluation and reproduction trains the algorithm in finding the closest solutions to the global optimal solution of the problem. The heuristic allows the chromosome encoding of different data structures that is a way of solving the problem with constraints (Streichert, Ulmer & Zell, 2004). The research done in the field proves that it is a heurist capable of solving and finding the Pareto set, because it is capable of processing a set of solutions in parallel and finding a good approximation in a single run (Zitzler & Thiele, 1998). It solves high dimensional spaces problems because they combine features from random search and Monte Carlo methods with some powerful heuristics borrowed from natural evolution (Tettamanzi. & Loraschi, 1993). This paper describes a new approach to portfolio management using stocks. The objective is to find stable companies, with good growth and a reasonable price, which have the potential for higher returns. To achieve this, an innovative approach was developed using Multi-Objective Evolutionary Algorithms with two objectives, the return and the variance of returns. Traditionally, optimization based approaches use either technical or fundamental indicators to find the composition of a portfolio. The proposed approach combines both fundamental and technical indicators. In the literature several fundamental indicators are available to be chosen from macroeconomic indicators, like inflation or unemployment, to industrial sector information, going
into detail into the company’s information. In this study a set of carefully selected nine fundamental indicators are used. They are based on the financial information publicly available for each company. The relevance of each indicator is determined during the optimization process by the MOEA algorithm, thus creating a self-adaptive process where the type of stocks picked change with time. The technical indicators are also optimized by the MOEA. The process/decision to buy a stock is thus divided into two steps; first, the best stocks are chosen based on the fundamental indicators and then, second, the technical indicators will tell when to buy or sell. The results presented in this paper demonstrate that the companies’ financial ratios plus technical indicators can be used to find the best companies to invest in. This paper is organized as follows: Section 2 presents the state-of-the-art for the portfolio model optimization and the technical systems for active portfolio management; Section 3 describes the proposed approach using MOEA to optimize the investment models developed; Section 4 discusses the experiments and results. Finally, the conclusions are drawn in section 5. 2.
Related work
2.1
State of the Art of Portfolio Optimization Some real-world problems involve simultaneous optimization of several incommensurable and often competing objectives. Normally, there is not only a single optimal solution, but a set of non-dominated optimal solutions. Multi-objective Optimization (MO) is a method to solve the problem of finding the best solutions when optimizing two or more objectives that are in conflict with each other, subjected to certain constrains (Fonseca, & Fleming, 1993). There are many measures of risk and return to evaluate the performance of a portfolio, and these measures can be used as the objectives to be optimized by the EA. The most popular in portfolio management are the Compound annual growth rate CAGR%, Managed Account Report (MAR) ratio, Sharpe Ratio, Value at Risk (VaR), the Mean (Portfolio Expected Return), and the Variance (Metaxiots & Liagkouras, 2012). 2.2
Mean variance – Model The Classical Mean-Variance portfolio optimization model introduced by Markowitz aims to select a set of assets to invest from the space of available assets and determine the fractions of the budget to be invested in each selected asset. In this model, the objective is to minimize the risk for each level of expected return of the portfolio. The Markowitz portfolio optimization can be stated mathematically as follows (Markowitz, 1952):
(1)
The portfolio (P) is a set of real valued weights (wi) of the stocks selected from the n available assets in the market.
1 ,
0 1,
1, … ,
(2)
The return of each asset is given by:
(3)
The expected return of the portfolio is given by the sum of the expected returns of the individual assets:
(4)
The Markowitz model can be optimized by heuristics such as greedy search (GS), SA, ACO, TS, GA, and Multi-Objective Evolutionary Algorithm (MOEA).
The lower partial moments or downside risk introduced by (Harlow, 1991) is a risk objective that takes into account the downside part of the distribution of returns. The downside risk makes the use of quadratic optimization techniques impossible, because the shape of the objective function is non-convex (Tettamanzi & Loraschi in 1993). The variance with skewness was developed based on the theory that portfolio return may not be a symmetrical distribution. This means that the distribution of return of individual assets tends to exhibit a higher probability of extreme values, like it was first suggested by (Samuelson, 1958) and later by (Ghang, Yang & Chang, 2009). The use of a higher number of risk objectives to optimize reduces the capacity to obtain portfolios with higher returns (Pandari, Azar & Shavazi, 2012). Fewer assets in a portfolio can represent a higher expected return, but it is obtained with a higher variance of the return (Lozano & Armañanzas, 2005). The existence of cardinality constraint affects the shape of the efficient frontier and causes discontinuities in the curve, like in the extended Markowitz model MVCCPO (Cesarone, Scozzari & Tardella, 2009). In addition, different neighborhood relations combined with local search strategies can be used to find the Pareto front (Schaerf, 2002). The constraint of transaction costs dislocates the Pareto curve in the return axis to lower levels (Lin & Wang, 2001). Extended models of Markowitz, like the one proposed by (Golmakani & Fazel, 2011) with four constraints (minimum transaction lots, sector capitalization lots, cardinality, and quantity constraints), can be created depending on the constraints. The authors proposed a heuristic called CBIPSO (combination of binary PSO with improved PSO) to solve the portfolio optimization problem. They compared their heuristic against the GA proposed by (Soleimani, 2009). 2.3
Active portfolio management approach based on technical and fundamental analysis An active portfolio management approach aims to outperform the main indexes using strategies with a higher frequency of trading. The strategy to enter in a position from a technical trading system is generated from trading rules based on technical indicators such as Relative Strength Index (RSI), moving averages and others (Hirabayashi, Aranha & Hitoshi, 2009). More recent systems use a combination of technical and intuition analysis to rank the best stocks to trade (Casanova, 2010) or a module to detect overbought/oversold conditions and short-term changes in relative value in contrast to the long-term fundamental value of a company through a learning mechanism, which manages the information derived from the technical indicators incorporated (Kaucic, 2012). Other recent types of technical trading systems are the ones that use k-NN classifiers to decide the buy and sell points, and, to exit the trading position, use an algorithm to optimize the parameters of trading, such as the stop gain and stop loss (Brasileiro, Souza, Femandes, & Oliveira 2013). Other approaches used in the selection model are the fundamental indicators to rank the stocks. The stocks with the best fundamental information are scored with higher values, and based on the evaluation they are ranked and picked to construct the portfolio (Huang, Chang, Kuo, Lin, Hsieh, Chang, 2012). In (Gorgulho, Neves & Horta, 2011) an expert technical trading system is implemented, describing the system architecture, the investment simulator, and GA is used to find the solutions. They tested the system against B&H, and a random selection, to prove the superiority of the GA system. 2.4 Selection of relevant works for portfolio optimization The advantage of using SA over other heuristic methods in portfolio optimization is the ability to avoid getting trapped in optimal local points as the algorithm allows greater flexibility and ability to approach global optimality (Schyns & Crama, 2003). The simulations performed by (Clack & Patel, 2007) showed that Age-Layered Population Structure EA (ALPS EA) reduces the premature convergence, providing better fitted solutions than the EA. To increase the diversity and robustness of the solutions, (Hassan & Clack, 2009) use a combination of two techniques mating restriction and diversity enhancement in the algorithm. (Krink & Paterlini, 2009) proposed a new MOEA, the Differential Evolutionary for Multi-objective Portfolio Optimization (DEMPO), comparing their heuristic with the QP and NSGA-II. The advantage of DEMPO is the ability to solve the portfolio optimization problem with real-world constrains and with satisfying results in a reasonable runtime. A more recent algorithm was developed by (Bhagavatula, Sanjeevi, Kumar &Yadav, 2014), the Indicator Based Evolutionary Algorithm (IBEA). The IBEA is a MOEA that uses an indicator called hypervolume to increase the diversity of the solutions. The algorithm proposed outperforms the others in terms of closeness to the true Pareto front. Table 1 presents a summary of the different solutions related to the optimization of portfolios using several parameters to describe their main characteristics.
Table 1: Overview over different approaches to portfolio optimization Reference Chang, Meade & Sharaiha (2000) Lin & Wang (2001)
Period of Simulation Mar 1992 to Sep of 1997 Mar 1992 to Sep of 1997
Algorithms Utilized GA TS SA GA based on NSGA –II and Genocop TS SA LS
Markets tested Hang Seng DAX, FTSE S&P, Nikkei Hang Seng index
Fitness functions
Markowitz´s Model
Best results obtained with the GA Heuristic
Mean, Variance
fixed transaction costs minimum lots
Markowitz´s Model
Hang Seng, DAX,FTSE,S &P, Nikkei
Average percentage loss
cardinality quantity
Markowitz´s Model
The proposal GA solved the portfolio selection problem efficiently The Tabu search is the heuristic that achieves the best Pareto Curve.
Floor ceiling, turnover, trading and quantity cardinality quantity
Markowitz´s Model with
Schyns & Crama (2003)
6 Jan of 1988 to 9 Apr 1997
SA
151 US Stocks
Mean, Variance
Lozano & Armañanzas (2005) Clack & Patel (2007)
Mar 1992 to Sep 1997
GS SA ACO ALPS1 system incorporated in GP
Hang Seng DAX ,FTSE S&P ,Nikkei FTSE 100
Mean, Variance
GA
Hang SENG FTSE S&P
Krink & Paterlini (2009)
From Oct 2001 to Oct 2006
Chen, Weng & Li (2009)
Mar1992 to Sep 1997
MOEO algorithm
Anagnostopoulu s & Mamanis (2011) Casanova (2010)
Mar1992 to Sep 1997
Gorgulho, Neves & Horta (2011) Kaucic (2012)
Results Obtained
minimum lots
NA
Ghang, Yang & Chang (2009)
Portfolio analysis
Mean, Variance
Schaerf (2002)
31 of May of 1999 to 31 of Dec 2005 From Jan2004 to Dec 2006
Constraints
Sharpe Ratio
Non-Linear Model
Mean, variance, Semi-variance, Variance with Skewness Monthly Return, and Variance
Markowitz´s Model
The ALPS GP obtained a return of 50%,and the standard GP a return of 33% The higher return obtained for S&P was 0.0023 with a risk 0.0008
Mean, Variance
NPGA2,NSGA-II PESA, SPEA2, e-MOEA LCS model
Hang Seng DAX ,FTSE S&P ,Nikkei Hang Seng DAX, FTSE, S&P, Nikkei IBEX 35
Quantity, change of weight, limits of class asset weight, limited asset allocation turnover rate cardinality quantity
Mean, Variance
cardinality quantity
ROI
Technical Analysis
15,3%
06 Jan 2003 to 06 Jan 2009 25 Jan2006 to 19 Jul 2011
GA
DJI
ROI
60%
EA
DJI
Pandari, Azar & Shavazi (2012)
Mar2002 to Mar2008
MOEA
Tehran Stock
Brasileiro, Souza, Femandes, & Oliveira 2013
2002 to 2008
Information Ratio, Omega, Sortino ratio Cumulative Return, Mean Return Cumulative Return,
Technical trading system Technical trading system
Bhagavatula, Sanjeevi, Kumar, & Yadav(2014)
NA
2005 to 2009
SPMIB.I
Markowitz´s Model
The SA is able to handle more classes of constrains than other heuristics They obtained a portfolio with a return of 3 and risk 0.1
BM & FBovespa
IBEA-D IBEIA NSGA-II SPEA 2
Hang Seng DAX, FTSE, S&P, Nikkei
Mean, Variance
Markowitz´s Model
The DeMPO outperformed the NSGA-II
Markowitz´s Model
Markowitz´s Model
Best performance obtained with a MOEO with a Return of 0.00859 and risk 0.000417 The SPEA2 is superior to others MOEA
GA model using Sharpe Ratio, Markowitz´s Model Technical trading system
Markowitz´s Model
70% 125% 119% 600% 350% The proposed method generates much larger profits compared to the other methods and to the buy and hold strategy. IBEA outperforms THE SPEA 2 and NSGA-II. Ibea – D provides more diverse solutions than IBEA
3. System architecture The proposed system optimizes an investment model using fundamental and technical indicators. The objective of the algorithm is to choose which stocks should be included in a stock portfolio. The software developed uses Multi-Objective Evolutionary Algorithms with two objectives: the return and the variance of returns. The algorithm chooses the weight to give each of the fundamental indicators and chooses the values of the technical indicators. The fundamental indicators are based on the financial statements information of each company. This way different strategies can be obtained with higher returns and variance and with lower returns and variance as will be shown in the results section. The pre-selection of fundamental indicators used here has been done in a way that enables the discovery of stable companies with good growth, a reasonable price, and which have the potential for higher returns. Nevertheless, it is the algorithm that is responsible for saying which indicator should have a higher or a lower weight in the final decision. The stocks with a higher value in the sum of all the fundamental indicators multiplied by each weight plus the technical indicators are chosen to be included in the portfolio. Therefore, it is this better selection of companies in the SP500 that is going to enable the algorithm to achieve higher returns than the SP500 index.
3.1
Algorithm architecture The system architecture is presented in fig. 1 constituted by three main modules, the Investor Simulator, the Optimization and the Data. The Data module is accessed by the investment simulator to test the strategies, and the optimization module implements the MOEA. The Optimization uses the results of Accumulated Return and Variance, obtained in the investor block to calculate the fitness function and evaluate the strategies. Based on the evaluation, it selects the chromosomes for reproduction and applies the methods of crossover and mutation to create new elements. The Data Block uses the financial statements and stock quotes to calculate the ratios used by the investor simulator. The Investor Simulator tests the strategies obtained in the optimization, depending on the investment model and using the inputs given by the user, to get the data for testing. Each day it evaluates the stocks and calculates the accumulated return of the portfolio from the beginning of the simulation and the monthly variance of the return. Each strategy is tested in the simulator, using the retrieved time series with a window that slides one day at each increment. The selected financial ratios are evaluated, and the computations are performed to do the trading decisions of the day. After finishing the time frame of each period of training, the results are recorded, and the reproduction of the population is performed. This process is repeated to achieve the number of interaction that signals the end of the training. After concluding the training of the population, the external file with the best solutions is used in a real test. The system uses the following parameters: the period of training, and the period of the real test. In addition, transactions costs are also included at 2% of the stock value.
Fig 1: System architecture
3.2
Fundamental Ratios By using the financial statements information, the software calculates quantitative measures and financial ratios that analyze a company in terms of profitability, liquidity, debt and growth. They are used to compare companies inside the same industry and to draw conclusions about the best companies to invest in. Next, the financial ratios used to evaluate the companies and the technical indicators used for trading will be presented. Debt Ratio (DR) is used to measure the company’s level of debt. Companies that have high debt compared to its assets are at a greater risk of going bankrupt if there is an adverse economic cycle, a reduction in their profits or an increase the interest rates on their debts. Usually companies with low Debt Ratio are in extremely competitive industries with constant need for innovation and updates of its products and production processes, which are carried out using external financing.
(5)
In fig. 2 it can be seen that the decrease of debt is coincident with the increase of the stock Price of the Bank of America.
Bank of America Corporation 90.0%
20
89.5%
15
89.0%
10
88.5%
5
88.0%
2010
2011 Debt-Ratio
2012
2013
0
Stock Price
Fig 2: Debt-ratio compared with Stock price
The Return of Equity (ROE) measures the performance of the company when it comes to generate profits using the company equity. It is obtained through three factors: operational efficiency, the efficient use of assets, and financial leverage. This ratio is used by investors to select companies that maximize the investment made in them. This means that, for every dollar invested, the companies are capable of creating a net profit greater in terms of percentage of capital invested.
! "#$ %&'
(6)
Fig. 3 demonstrates that the increase of ROE is discounted by the market with the increase of the company’s stock price.
Bank of America Corporation 6.0%
20
4.0%
15
2.0%
10
0.0% -2.0%
2010
2011 ROE
2012
2013
5 0
Stock Price
Fig 3: ROE compared with Stock price
The Profit margin ratio (PM) measures the profitability of the company, calculating the percentage of the revenue retained after paying the operating, administrative, and financial costs as well as taxes. (
! "#$ )&
(7)
When analyzing the evolution of the PM and stock price of Apple, it is possible to observe the positive correlation of both observed in fig. 4.
Apple Inc 30.0% 25.0% 20.0% 15.0% 10.0% 5.0% 0.0%
800 600 400 200 2010
2011
2012
Profit-Margin(%)
0
2013 Stock Price
Fig 4: Profit margin compared with Stock price
The Price Earnings Ratio (PER) is a valuation ratio of a company´s current share price compared to its per-share earnings; it is used by stock investors to choose the companies that are more undervalue in the market. PER tends to be lower for companies such as slow growers and higher for fast growers, because, in the share price, investor expectations are incorporated regarding the future. The best use of the ratio is to find the cheapest company in a sector because these have similar profits margins, but it can be used to compare companies from different sectors. It allows to compare the historical record of the PER in order to get a better perspective on the levels of overvaluation and undervaluation of each stock. (
*+ (# (*
(8)
Fig. 5 compares the PER and the stock price and shows the direct correlation between them.
Google Inc 1500
40 30
1000
20
500
10 0
2010
2011
2012
PER
2013
0
Stock Price
Fig 5: PER compared to Stock price
The percentage of revenue growth (RG) is an economic indicator that shows the evolution of the business. Two factors are responsible for its increases, the company is a better competitor and is gaining market share from other competitors, or the company is inserted in a fast growing sector and is growing with it. Although this indicator is important to analyze the company from the growth point of view, it does not give any indication as to profitability.
ܴ ܩൌ
ܴ݁ ݁ݑ݊݁ݒെ ܴ݁ ݁ݑ݊݁ݒ ܴ݁ ݁ݑ݊݁ݒ
(9)
The revenue increase in Apple’s case means an increase of Profits that is followed by the increase of the stock price, fig.6.
Apple Inc 200
800
150
600
100
400
50
200
0
2010
2011
2012
Revenue(Billions)
0
2013 Stock Price
Fig 6: Revenue compared to Stock price
Common stock outstanding (CSO) represents the fundamental ownership hold of the corporation by the shareholders. When the company issues shares, this number is added to the previous value in the Balance sheet, representing an increase of total number of shares and a distributing of the company's value by a greater number of shares. The reduction of the number of outstanding shares represents an increase in EPS and a decrease of PER ratio. The objective when using this indicator is to find companies that, in recent years, have repurchased their shares and thus reduced the number of shares outstanding. ∆-*
CSO 1 CSO CSO
(10)
As we can see in fig. 7, when the value of a company is distributed by a lower number of shares, the reduction of common stock outsanding is recognized by the markets and the stock increases in value.
Wal Mart Stores 3600
100
3400
50
3200 3000
2010
2011 CSO millions
2012
2013
0
Stock Price
Fig 7: CSO compared to Stock price
A positive trend of net income (NI) shows that the company has increased its profits, the objective of this indicator is to choose the companies with higher growths. A positive trend of NI shows the company has consistency and durability in its profits, and a good result obtained in one year is not just a result of favourable economic growth of the GDP or a financial engineering. When comparing the trends of net income and stock price, divergences can be found between both, which can indicate the company’s undervaluation, if the net income trend shows a positive tendency and the stock prices do not show a similar behaviour. ∆ NI
NI 1 NI NI
(11)
Fig.8 demonstrates some correlations between the NI and the stock price. If there is some divergence between them, it is possible that in the future a correction will materialize.
Wal Mart Stores 20000
100
10000
50
0
2007
2008
2009
2010
2011
Net Income( millions)
2012
0
Stock Price
Fig 8: Net-Income compared to Stock price
The Payout ratio (PR) measures the percentage of net income distributed by the investor as dividends. Companies with high PR are stable companies which do not need to invest vast amounts of money in new factories and facilities but, at the same time, they are normally inserted in more stable industries that do not have high growth rates and their stock performance will be smaller than those in a fast growth stock. The objective of using this ratio is to select companies with low PR to achieve greater stock increase. Payout Ratio
)<< = *+ > ( *+
(12)
Fig.9 demonstrates the effect of paying part of the profits as dividends. A higher percentage of profits paid will imply less tendency of the stock price to increase in value.
Apple Inc 30.00%
800 600
20.00%
400
10.00% 0.00%
200 2010
2011 Payout-Ratio(%)
2012
2013
0
Stock Price
Fig 9: Payout-ratio compared to Stock price
A company with increased capital expenditures (CE) where the net income does not have the same behaviour is probably because it is inserted in a competitive industry. The objective of this indicator is to avoid companies with higher positive variation of CE than the NI. ∆ CE
- 1 - -
(13)
In the case of Google, in fig.10, the increase of CE is followed by the stock price due to the company’s ability to produce profits with its operations.
Google Inc 8000
1500
6000
1000
4000
500
2000 0
2010
2011
2012
CE (millions)
0
2013 Stock Price
Fig 10: CE compared to Stock price
Cash from operating activities (CFOA) is an indicator used to check the real efficiency of operations in generating money (the ability to transform paper operating income into the income statement in receivable cash). This accounts only for the cash flow that enters the company, because companies can have, in the income statement, high operating net income, but it can be inefficient in the collection of its cash profits. This indicator is used to select companies that have high net incomes produced by the operating revenue. ∆ CFOA &
'()* + '()* '()*
(14)
Fig.11 demonstrates a positive correlation between the CFOA and the stock price of Alcoa, meaning that markets discount the operating performance of the company in its price.
Alcoa Inc 2500 2000 1500 1000 500 0
20 15 10 5 2010
2011 CFOA (millions)
2012
2013
0
Stock Price
Fig 11: CFOA compared to Stock price
3.3
Technical Indicators Several technical indicators are going to be used in the automatic trading system. It is this set of parameters and indicators that define what the algorithm will do. The trading indicators and parameters are going to be presented next. The parameters which are going to be used are the following: markets to invest, market timing, Min Global Value, protection of capital, exit of a wining position, position size, and stock number. Select the Markets to invest, consider the available budget, possible costs in transactions, the knowledge it has about the business of the companies to invest, access to information, and experience. In this paper, the stocks that compose the index SP&500 were selected. The authors chose the SP500 because it is an index with many stocks, which represents the main companies in the United States and where there is a lot of information available when it comes to the companies’ financial statements. Entry or Market Timing is the exact price and the market conditions that need to be materialized to enter in a stock position, the objective is to define a set of rules that give an entry signal to improve the timing of buying and increase the reliably of the system (Tharp, 2007). There are different types of moving averages, depending on the calculated method, but the meanings and interpretations are the same. To decide when to enter the market, the intersection between the technical indicator Simple Moving average (SMA) and the price is going to be used. The value to be optimized by the software is the number of days in the SMA. In fig. 12 a trend price with an SMA of 50 days is presented.
S&P 500 Index 1600 1500 1400 1300 1200 1100 Mar/00
Mai/00
Jul/00 SP 500
Set/00
Nov/00
SMA 50
Fig. 12: Trend of SP500 with SMA of 50 days
The Global Value of each stock is a valuation done daily using the trimestral financial ratios and the daily PER, which is updated using the close price to rank the stocks for the algorithm to make a trading decision. These values are calculated using the vector of weights of ratios of the chromosome multiplied by the company’s respective ratios, as demonstrated by Eq. 15. In this equation n represents the number of fundamental indicators incorporated in the chromosome, this is seven for the models used. The stocks with a higher value in the global value are chosen to be included in the portfolio.
݈ܾ݈ܽܩ௩௨ ൌ ݐ݄݃݅݁ݓ ݅ݐܴܽ כ
(15)
ୀଵ
Stops Loss and Protection of capital are predetermined policies that reduce a portfolio exposure, by getting out of a losing position, not allowing one or more investments to continue to lose money, and protect the remaining capital available to continue the investing activity. The stop loss percentage, defines the maximum loss for each investment, by defining the exit point, when the price tendency does not follow as expected, the stop price is calculated using equation 16. The algorithm is going to find the value of the stop loss. It calculates the price to exit considering the entry price of the investment less the loss defined by the StopLoss. In some cases the algorithms has a very high value for StopLoss, meaning that the software never exits from the investment. This means that when investing in good companies it is better to stay with the stock in bad markets times, because in the long run the stock price will recover. (,- (. 1 1 *=@
(16)
For Exit of a winning position, the parameter ‘take profit’ is used. If the ‘take profit’ is for example 10%, the stock will be sold after this profit is achieved. This will determine the sale value of successful investments based on the purchase price of the shares according to equation 9. (-/ (. 1 A B(C
(17)
The position size is the percentage of the current portfolio value to invest in each new stock; this defines the level of concentration or diversification in the portfolio. For example, in a strategy that invests a low percentage in each investment, the portfolio can have a higher number of assets. However, if the value of the position size is high, for example 20 %, which is the maximum possible due to Quantity constraint, the Portfolio will be limited to 5 stocks. The algorithm will find the optimal value for this parameter in compliance with the Quantity constrain. The stock number parameter defines the number of stocks that compose the portfolio. In a strategy where the position size does not allow the number of stocks defined by the stock number the maximum number of stocks is defined by the position size. For example a position size of 20% and a stock number of 10, the portfolio is limited to 5 stocks. On the other hand in a strategy
where the restriction of the position size is smaller than the stock number the maximum number of stocks is defined by stock number. For example a position size of 20% and a stock number of 4, the portfolio is limited to 4 stocks each with 20%. 3.4
Chromosome structure The representation of the chromosomes is similar for the three investment models, where each individual of the population is composed of a sequence of values called genes. The Chromosome is divided into two parts, the first group is the financial ratios weights and the second one is the trading parameters. 3.4.1 First model of the chromosome In the first model of the chromosome, the first seven genes are financial ratios weights. The remaining genes define the behavior of the trading systems. In fig. 13 the model of the chromosome is represented. The seven fundamental weights are the DR, ROE, PM, PER, GR, ∆-* and ∆ NI. This model only invests in companies that have some potential for a good return, using the first parameter of trading, the gene of Min Global Value optimized, to filter the candidates to enter in the portfolio. This gene defines the minimum global value of the stock that a candidate needs to have to enter in the portfolio.
Fig. 13: Chomossome that represent the first model
It uses five parameters of a technical trading system: the minimum global value, the stop loss, take profit to determine the exit points, the number of days to use in a SMA to trigger the entry point, and a size position to define the percentage to allocate to each stock. In fig. 14 it is represented the part of chromosome that refers to the trading parameters.
Fig 14: Trading Parameters for first Model.
3.4.2 Second Model of Chromosome This model was developed to simulate a portfolio that always keeps a determined number of stocks in it. It has the first seven genes of the previous model, the gene of the position size, and adds a new one, the limit number of stocks in the Portfolio. The model operation is to maintain the stocks in the portfolio which have the highest valuations, when one stock outside of the portfolio has a better valuation than the worst one in the portfolio, the latest will be replaced by the first. In fig. 15 the chromosome is represented.
Fig 15: Chromossome representing the second model
3.4.3 Third Model of Chromosome This model was developed to improve the efficiency of the MOEA through the increase of the fundamental indicators used in the stocks’ valuation. To the previous valuation stocks method, three new fundamental indicators are introduced: the payout ratio, the Growths of CFOA and ∆ CE. The trading parameters of this model are equal to the ones in fig. 14.
Fig 16: Chromossome representing the third model
3.5
Constraints For the simulations of the portfolios to be as realistic as possible, in the design of the models some real constraints were included. For the first and third model, the following four were considered while for the second model the transaction costs constraint was excluded. Cardinality constraint limited the portfolios to a maximum of 20 stocks. The limit was chosen based on obtaining the benefits of a diversified portfolio, and studies on mathematical models which show that maintaining a very diverse portfolio of stocks of about 30 presents a higher level of risk reduction (Hillier, Ross, Randolph, Jeffrey & Jordan, 2010). The limit allows greater economic monitoring of the selected companies, like Warren Buffett’s philosophy, in which it should be possible to focus more attention on a smaller set of companies instead of having a great diversification, because the investor has better knowledge of the company, its products, competitors, debt levels, and future long-term economic prospects of the business
(Cunningham, 1998). Quantity constraint was used to limit the gene position size, by putting a maximum and minimum value for the size of the position. The minimum limit is set to 5% of the portfolio value at the time of the transaction, and the maximum value is 20%. The lower limit is to avoid practically insignificant positions to the performance of the portfolio, and the upper limit is to avoid too much exposure or weight for any stock. Long only constraint signifies that performing short selling operations is not allowed, meaning the weight invested in any stock is always positive. It is a restriction used by a great number of value investors and institutional funds because the risks associated to the short selling are considered higher than the ones to long positions. Transaction costs for the first model are a commission of 2% of the value of each transaction to simulate real costs. For the second model, the transaction costs are ignored to allow the algorithm to change the assets without restrictions and, thus, without affecting the return. 3.6
Optimization strategy
For optimizing the investment models, a MOEA proposed by (Zitzler& Thiele, 1998) was used, the SPEA II. The crossover method randomly selects from the mating pool four chromosomes to provide their genes for a new chromosome. The mutation performed casually selects genes, from one to four, and mutates them using a rate limited by an interval. To evaluate the solutions, the measures of ROI and Variance were used. 4. Results 4.1
First model using Multi-objective The simulation for the first model of the chromosome was trained from 2010-06-17 to 2012-01-03, using a MOEA with two objectives, return and variance. In Fig. 17, the results of the real test executed between 04.01.2012 and 07.06.2013 are presented, with the population obtained in the training. In this figure it is also shown the training of the algorithm for this same period of testing. The trained Pareto curve is more ideal, but the test points (with values that came from the training in the previous period) also show that they represent a Pareto curve with diverse and well-spaced points. The performance of the index, represented as a triangle in the figure, for the same period proves that the use of this MOEA is a better investment technique than just following the index.
Fig 17: Results from real test using the objectives return and variance of return.
From this simulation five results with different variances were selected to analyze the chromosomes and acquire a better insight on the type of solutions found by the algorithm. Table 2 shows the results for the two objectives of the chromosomes selected. Table 2: Results from the test
SP&500
Return (%)
Variance (%)
28.69
14,20
Chromosome ID 1
50.24
19.71
27
45.83
17.70
36
38.81
14.28
51
13.66
4.94
54
22.73
6.25
In Table 3 the value of the genes for the same chromosomes is presented. When analyzing the genes of the first chromosome, we can see it has a preference for companies with high profit margins, earnings growth, and uses little diversification. Chromosome 54 is a strategy that allows greater diversification, it allocates 5% to each stock, the ratios with more importance are the ROE, and the rate growth of net income. It is a more conservative strategy that invests in established businesses with monopoly characteristics. Chromosome 51 is the strategy with the highest frequency of trading, but obtained a lower return due to the transactions costs. The analysis of the genes in the chromosome demonstrates the highest returns are achieved by a better selection of companies with a higher concentration of the investment.
Table 3: Genes of the Chromosomes Genes
C1
C27
C36
C51
C54
Debt ratio
0,53
0,53
0,28
0,28
0,28
ROE
0,64
0,12
2,24
0,12
2,24
Profit Margin
3,01
0,61
0,49
0,96
1,01
PER
0,54
0,40
0,23
0,23
0,27
Δ of Rev.
0,34
1,13
0,62
0,65
0,57
Δ common Stock out
1,33
1,08
1,04
0,97
1,25
Δ net income
1,79
2,07
1,24
1,70
1,95
Min Global Value
0,00
0,00
0,00
0,00
0,00
Stop Loss
1,11
0,88
1,98
0,88
0,82
Take Profit
1,89
2,46
1,18
0,12
1,36
Days of MMA Position Size
1,00 0,20
5,00 0,20
4,00 0,20
1,00 0,05
1,00 0,05
A comparison of the trend of S&P 500, and the trends of the strategies obtained by the EA was performed. In fig. 18, the accumulated return of the best and the worst chromosome as well as the average result of all the chromosomes compared to the Index S&P 500 can be seen. The diversification of the capital to invest in the solutions found by the algorithm is a more profitable strategy than the passive investment of buying a set of stocks that are representative of the index.
Fig 18: Result of the real test using the first model
4.2
Second model
The population in this simulation was trained using the MOEA during the period 2010-06-17 to 2012-06-11. The real test is executed from 2012-06-12 to 2013-06-11. The results in Fig. 19 are solutions with lower risk in relation to the index, in which the effect of the efficiency in the use of risk for the obtained returns is verified.
Fig 19: Result of the real test using the second model
Five chromosomes were selected from the population based on the results that they obtained in the real test. These are shown in Table 4. Table 4: Results of the real test Return (%) SP&500
25.55
Variance (%) 10.82
Chromosome ID 2
36.4
8.02
10
27.59
7.18
23
18.31
4.58
29
11.84
2.25
40
8.89
1.16
By analyzing the genes in Table 5 the difference in results by chromosome 2 in relation to the others are justified by a higher concentration of investments, and the selection of companies with better profit margin and net income. The lower return of chromosome 40 is justified by the lower importance to the level of debt and Profit margin of the companies with lower percentages invested in each stock. Table 5: Genes of the Chromosomes Genes Debt ratio
C2
C10
C23
C29
C0 0,000002
0,000006 0,000002
0,017
0,0003
ROE
0,00015
0,00015
0,31
0,0029
0,31
Profit Margin
0,3578
0,0059
0,02617
0,2156
0,00286
PER
1,11
1,11
2,099
0,8637
2.099
Δ of Rev. Δ common Stock out Δ net income
0,0739
0,0739
0.8549
1.0786
0,01089
1,3989
1.3983
1.9047
1.0967
1.5
2.9453
1,8516
0.331
0,043
0,638
Stocks Number
8
7
9
6
4
Position Size
0,18
0,18
0,063855
0,0638
0,0638
A comparison of the S&P 500 index and the strategies obtained by the EA was performed for the second investment model. Fig. 20 shows the accumulated return of the best and the worst chromosome as well as the average result of all the chromosomes. The population results are lower in the index due to the higher accumulation of results in the lower risk zone, which can be checked in fig. 19.
Fig 20: Result of the real test using the second model
4.3
Third Model
The population in this simulation was trained using the MOEA during the period 2012-01-02 to 2012-12-31. The real test was executed from 2013-01-02 to 2014-02-07. The results in fig. 21 are more concentrated than those in the previous experiences meaning that with more fundamental indicators, it is possible to focus more on the type of portfolio management. The results in circles represent the MOEA trained in the period of the real test.
Fig 21: Result of the real test using the third model
Five results were selected from the real test, from different solutions spaces, in order to analyze their performances. The results are presented in table 6. Table 6: Results of the real test
SP&500
20
Variance (%) 7.89
Chromosome ID 4
28.3
19.6
6
38.7
28.6
7
25.7
21.7
15
18.5
9.0
29
20.15
5.7
Return (%)
Table 7 shows the genes of the chromosomes for the previous selected results. It can be seen that, as before, the ROE and Profit Margin are the most important genes. However, with the introduction of CFOA, the gene of net income lost some importance, and both CE and CFOA have high value coefficients. With the exception of chromosome 7, higher payout ratios generated investment strategies with lower returns. Table 7: Genes of the Chromosomes Genes PER Debt ratio
C4 0,206
C6 0,206
C7 0,15
C15 0,206
C29 0,206
0,754
0,751
0,868
0,869
1,053
ROE
2,360
0,985
1.2
1,390
2,335
Profit Margin
2,309
1,239
2.31
2,011
0,724
Payout Ratio
0,397
0,429
0,17
0,623
0,571
Δ of Rev.
0,170
0,319
0,375
0,236
0,480
Δ common Stock out
0,301
0,727
0,375
0,189
0,216
Δ net income
0,341
0,730
0,341
0,730
0,621
Δ CE
1,182
0,227
1.41
1,778
0,227
Δ CFOA
0,995
0,769
0,756
1,308
1,434
Min Global Value
0,355
0,430
0,493
0,554
0,462
Stop Loss
0,635
0,359
0,635
0,233
0,310
Take Profit
0,930
0,727
0,923
0,727
0,316
Days of MMA Position Size
0,029
6,264
0.03
0,043
0,156
0.2
0,2
0,2
0,034
0,045
A comparison was performed between the trend of S&P 500 and the strategies trends obtained by the EA for the third investment model. In fig. 22 it can be seen the accumulated return of the best and the worst chromosome as well as the average result of all the chromosomes compared to the Index S&P 500. In this model, the strategies found are closer to each other, meaning some robustness of the results. In fig. 22, the difference between the worst and the best chromosome is smaller than the one in the two other models.
Fig 22: Result of the real test using the first model
Fig. 23 represents the results obtained in the training period 2012-01-02 to 2012-12-31 for the first and third model. We can verify there is a higher diversity of results for the first model, with a higher divergence of returns.
Fig 23: Training of first and third models
In fig. 24 it is represented the results of the populations trained before the real test for Model 1 and Model 3 in the period 201301-02 to 2014-02-07. The results show the first model of chromosomes has a higher dispersion than the third model. The introduction of the new indicators to evaluate the stock performance improved the overall performance of the MOEA.
Fig 24: Result of the real test using the first and third models
5. Conclusions This work proposes a multi-objective GA to efficiently manage a stock portfolio. This approach can be applied to the management of portfolios with great results due to the optimization of the strategies and the algorithms ability to analyze hundreds of companies in a few seconds. The EA, using fundamental analysis and trading parameters to stock investment, finds solutions that in general outperformed the Index. The solutions with higher returns and less variance in the portfolio are due to a higher concentration of the investments in a few stocks, and a better selection of the companies based on the financial ratios ROE, debt ratio, and growth rate of net income. The increase of the number of fundamental indicators raises the precision of the MOEA and the results of real simulations become more precise, meaning that the CFOA and CE and Payout ratio are relevant indicators. The comparison of the first and third models demonstrates that the third achieves in training and real test more precise results. Therefore, the use of more indicators allows the selection of companies that better correspond to the expected performance. For future work, it could be validated the proposed approach in different stock markets with different trends and volatility levels, thereby ensuring robustness of the approach in the most adverse environment of the market. Additionally, the approach can still receive improvements by: implementing other risk measures and performance indicators to use as new objectives in the EA, to study which objective functions give the best results; allowing short selling in conjunction with the long positions The algorithm will invest in the best companies in a bull market, and short the worst in the bear market; incorporating macroeconomic indicators in the algorithm to determine the general tendency of the market; incorporating industrial indicators and associate the companies affected by these indicators to try to extract conclusions about how to use them to find the best industries to invest; testing this strategy in different markets, both developed markets like the DAX, FTSE, CAC or NIKKEI and emerging ones, to verify which indicators are more valuable and have the ability to identify outstanding companies.
6. Acknowledgements This work was supported by FCT project PEst-OE/EEI/LA0008/2013.
7. References Achelis, H.(2000). Technical analysis from A-to-Z. Vision Books. Anagnostopoulos, K. & Mamanis, G. (2011). The mean-varaince cardinality constrained portfolio optimization problem:An experimental evaluation of five multiobjectives evolutionary algorithms. Expert Systems with Applications, vol-38, 14208-14217. Bhagavatula, S., Sanjeevi, S., Kumar, D. & Yadav,K. (2014). Multi-Objective Indicator Based Evolutionary Algorithm for portfolio optimization. IEEE International Advanced Computing Conference (IACC), 1206-1210. Cunningham, L. (1998). The essays of Warren Buffett: Lessons for corporate America. The Cunningham Group. Chang, T. & Meade, N. Sharaiha, Y. (2000). Heuristics for cardinality constrained portfolio optimisation. Computer & Operations Research, vol-27, 1271-1302. Clack, C. & Patel, S. (2007). ALPS evaluation in Financial Portfolio Optimization, IEEE Congress on Evolutionay Computation (CEC), 813-819. Cesarone, F. & Scozzari, A. & Tardella, F.(2009). Efficient Algorithms for Mean-Variance Portfolio Optimization With HardWorld Constraints, Giornale dell´Istituto Italiano degli Attuari, vol-72, 37-56. Chen, M. R., Weng, J., & Li, X. (2009). Multiobjective Extremal Optimization for Portfolio Optimization Problem. IEEE International Conference on Intelligent Computing and Intelligent Systems (ICIS), 552-556. Casanova, I. J. (2010). Trading-LCS:Dynamic stock portfolio decision-making assistance model with based machine learning, IEEE Congress on Evolutionay Computation (CEC), 1-8. Fonseca, C. & Fleming, P. (1993). Genetic Algorithms for Multiobjective Optimization:Formulation. International Conference on Genetic Algorithms, 416-423. Ghang, T. J., Yang, S. C. & Chang, K. J. (2009). Portfolio optimization problems in different risk meusures using genetic algorithm. Expert Systems with Applications, vol-36, 10529- 10537. Golmakani, H. R. & Fazel, M. (2011). Constrained Portfolio Selection using Particle Swarm Optimization. Expert Systems with Applications, 38, 8327-8335. Gorgulho, A., Neves, R. & Horta, N. (2011). Appying a GA kernel on optimizing technical analysis rules for stock picking and portfolio composition. Expert Systems with Applications, vol-38, 14072 - 14085. Harlow, H.(1991). Asset allocation in a downside-risk, Financial Analysts Journal, vol-47, 28-40. Hassan, G. & Clack, C. (2009). Robustness of Multiple Objective GP Stock-Picking in Unstable Financial Markets. ACM Genetic and Evolutionary Computation (GECCO), 1513-1520. Hirabayashi, A., Aranha, C. & Hitoshi I. (2009). Optimization of the trading Rule in Foreign Exchange using Genetic Algorithm. ACM Genetic and Evolutionary Computation (GECCO), 1529-1536. Hillier, D., Ross, S., Randolph, W., Jeffrey, J. & Jordan, B. (2010). Corporate Finance (First European Edition ed.), McGrawHill. Huang, C., Chang, C., Kuo Li, Lin Bo, Hsieh, T. & Chang, B. (2012). A Genetic-Search Model For First-Day Returns Using Fundamentals. Machine Learning and Cybernetics, vol-5, 1662-1667. Krink, T. & Paterlini, S. (2009). Multiobjective optimization using differential evolution for real-world Portfolio optimization Computational Management Science, vol-8, 157- 179. Kaucic, M. (2012). Portfolio Management Using Artificial Trading Systems Based on technical Analysis, Genetic Algorithms in Applications, Chapter 15, Intech. Lin, D. & Wang, S.(2001). A multiobjective genetic algorithm for portfolio selection problem. Lozano, J. & Armañanzas, R. (2005). A Multiobjective Approach to the Portfolio Optimization Problem, IEEE Congress on Evolutionay Computation (CEC), 1388-1395 Markowitz, H. (1952). Portfolio Selection. The Journal of Finance, vol-7, 77-91. Murphy, J. (1999). Technical analysis of the financial markets:A comprehensive guide to trading methods and Aplications. Prentice Hall Press. Metaxiots, K.,& Liagkouras, K.(2012). Multiobjectve Evolutionary Algrithms for Portfolio Management:A comprehensive literature review. Expert Systems with Applications, vol-39, 11685 - 14085. Pandari, A. R., Azar, A. A. & Shavazi, R. (2012). Genetic algorithms for portfolio selection problems with non-linear objectives. African Journal of Business Management, vol-6, 6209-6216.
Samuelson, P.(1958). The fundamental approximation theorem of portfolio analysis in term of means variances and higher moments. Review of Economic Studies, 65-86. Schaerf, A. (2002). Local Search Techniques for Constrained Portfolio Selection Problems, Computational Economics, 177-190. Schyns, M. & Crama,Y.(2003). Simulated annealing for complex portfolio selection problems. European Jornal of Operational research, 150, 546-571. Streichert, F., Ulmer, H., & Zell, A. (2004). Evaluating a hybrid encoding and three crossover operators on the constrained portfolio selection problem, IEEE Congress on Evolutionay Computation (CEC), 932-939. Soleimani, H. Golmakani, H. Salimi, M (2009). Markowitz-based portfolio selection with minimum transaction lots, cardinality constraints and regarding sector capitalization using genetic algorithm, Expert Systems with Applications, vol-36, 5058-5063. Tettamanzi, A. & Loraschi, A. (1993). An evolutionary algorithm for portfolio selection in a downside risk framework. Tharp,V. (2007), Trade your way to Financial Freedom, McGraw-Hill. Brasileiro, R., Souza, V., Femandes,B., Oliveira A. (2013). Automatic method for stock trading combining technical analysis and the Artificial Bee Colony Algorithm, IEEE Congress on Evolutionay Computation (CEC), 1810-1817. Zitzler, E. & Thiele, L. (1998). An Evolutionary Algorithm for Multiobjective optimization: The Strength Pareto Approach. TIKReport, 43.
Highlights This work proposes a multi-objective GA to efficiently manage a stock portfolio. Two objectives the return and the risk (variance of returns) are used to optimize the models. To select the best companies the algorithm uses fundamental financial ratios.
To find the best entry point the algorithm uses technical indicators. The results found outperform the main indexes with lower volatility.