Risk Aversion Rebalancing
Risk Aversion Rebalancing
Article
Special Issue
Machine Learning Applications in Finance
Edited by
Prof. Dr. Jong-Min Kim
https://doi.org/10.3390/jrfm13070155
Journal of
Risk and Financial
Management
Article
A Machine Learning Integrated Portfolio Rebalance
Framework with Risk-Aversion Adjustment
Zhenlong Jiang , Ran Ji * and Kuo-Chu Chang
Department of Systems Engineering and Operations Research, George Mason University, 4400 University Dr.,
MS 4A6, Fairfax, VA 22030, USA; zjiang@gmu.edu (Z.J.); kchang@gmu.edu (K.-C.C.)
* Correspondence: rji2@gmu.edu
Received: 31 May 2020; Accepted: 13 July 2020; Published: 16 July 2020
Abstract: We propose a portfolio rebalance framework that integrates machine learning models
into the mean-risk portfolios in multi-period settings with risk-aversion adjustment. In each period,
the risk-aversion coefficient is adjusted automatically according to market trend movements predicted
by machine learning models. We employ Gini’s Mean Difference (GMD) to specify the risk of a
portfolio and use a set of technical indicators generated from a market index (e.g., S&P 500 index) to
feed the machine learning models to predict market movements. Using a rolling-horizon approach,
we conduct a series of computational tests with real financial data to evaluate the performance of
the machine learning integrated portfolio rebalance framework. The empirical results show that
the XGBoost model provides the best prediction of market movement, while the proposed portfolio
rebalance strategy generates portfolios with superior out-of-sample performances in terms of average
returns, time-series cumulative returns, and annualized returns compared to the benchmarks.
1. Introduction
The purpose of financial portfolio optimization is to allocate the capital weights among a set
of assets in an optimal manner such that the investor’s utility is maximized. The earliest study in
the portfolio optimization field dates back to the 1950’s with the mean-variance model proposed
by Markowitz (1952), which seeks the optimal trade-off between the reward and risk measures
represented by the mean and the variance of the portfolio returns. Though the mean-variance
model is widely used in practice, it has two main well-known limitations. The solution of the
mean-variance model is consistent with the principle of utility maximization only if the asset
returns are normally distributed or the utility function is quadratic, where the normality and
quadraticity are not usually satisfied in the real financial world. To mitigate the shortcomings
of the variance, many other risk measures have been investigated, which include but are not
limited to the semi-variance (Markowitz 1959; Markowitz et al. 1993), semi-deviation Ogryczak and
Ruszczyński (1999, 2001), mean absolute difference (Konno and Yamazaki 1991), Value-at-Risk
(Duffie and Pan 1997; Gaivoronski and Pflug 2004), Conditional-Value-at-Risk (CVaR) (Rockafellar
and Uryasev 2000), Entropic Value-at-Risk (EVaR) (Ahmadi-Javid 2012), and Gini’s Mean Difference
(Shalit and Yitzhaki 1984; Yitzhaki 1982). We refer to Fabozzi et al. (2010) for a detailed review of risk
measures. Each of the risk measures employed in the portfolio optimization framework constitutes a
family of mean-risk models.
The efficient solutions of the bi-objective mean-risk portfolios can typically be achieved by solving
one of the three optimization models: (1) maximizing the expected return subject to an upper-bounded
budget level on the risk measure; (2) minimizing the risk measure while requiring the mean return
to exceed an acceptable threshold value; (3) maximizing the risk-adjusted mean return, which takes
the form of mean return less the risk measure multiplied by a risk-aversion coefficient selected by
the investor. This risk-aversion coefficient represents the preference or risk attitude of the investor
toward the market environment, which is a reflection of the market trend. If the market is in a bearish
trend, the investor is supposed to be more risk-averse and adjust the portfolio to reduce risk, which
can be achieved by solving the model with a large risk-aversion coefficient value. In contrast, if the
market is in a bullish trend, the investor should be less risk-averse and adjust the portfolio with more
attention to gain return, which leads to a smaller value of the risk-aversion coefficient. In real-world
financial industries with a multi-period investment horizon, to accommodate the volatile market
environment, the portfolio is constructed within a dynamic rebalance strategy to obtain high overall
returns while keeping the risk under control (Geweke and Amisano 2010). If the market trends can
be well captured and predicted, the investors can rebalance their portfolios by simply adjusting the
risk-aversion coefficient. The adjustment of the risk-aversion coefficient in response to the (predicted)
market trend thus plays a critical role in this portfolio rebalance strategy. We propose to address this
adjustment via machine learning models utilizing the technical indicators.
Machine learning algorithms are widely used to forecast the direction of stock markets.
For instance, Ni et al. (2011) build a predictive model that combines the fractal feature selection method
and support vector machine to predict the daily price moving direction of an index. Hu et al. (2018)
integrated the sine-cosine algorithm and the basis of back propagation neural networks to predict
the directions of the S&P 500 and Dow Jones Industrial Average Indices. García et al. (2018b) used
a hybrid fuzzy neural network to predict the next day direction of the German DAX-30 stock index.
Cervelló-Royo and Guijarro (2020) compared the accuracy of four different machine learning techniques
(Random Forest, Deep Learning, Gradient Boosting Machines, and Generalized Linear Models) for the
10-days ahead trend of NASDAQ index prediction.
The technical indicators are computed based on historical data (e.g., past price and volume
patterns) of one specific asset to derive useful information that is believed to persist into the future.
Schwager (1993, 1995) finds that technical analysis is used by many top traders and fund managers
through his interviews and conversations. Covel (2004, 2009) advocates for the use of technical analysis
exclusively by analyzing various practical and successful case studies in hedge fund companies.
The technical indicators are devised to assist the trading actions by sending trading signals (i.e., buy or
sell signals) to the analysts for the classical all-or-nothing trading strategy. The profitability of asset
trading rules based on technical analysis, such as filter rules Fama and Blume (1966), moving averages
Brock et al. (1992); Kwon and Kish (2002), momentum Ahn et al. (2003); Conrad and Kaul (1998),
and automated pattern recognition Lo et al. (2000) have been well studied in the literature. The
power of the technical analysis was later extended to the asset allocation and portfolio optimization
problems. By assuming a log-utility function of the investor, Zhu et al. (2009) considers an asset
allocation model with two assets (i.e., one risky and one risk-free) by incorporating the trading signals
generated by technical indicators on the specification and adjustment of the risk tolerance coefficient
in the utility function. Their numerical results display the superior performance of the proposed
approach compared to the all-or-nothing rule as a benchmark. Gorgulho et al. (2011) investigate
the financial portfolio management strategies by taking advantage of technical indicators such as
moving averages and relative strength indicator, and demonstrate its profitability over the classical
buy-and-hold and purely random strategies. Ji et al. (2017a) employ the moving averages to detect
persisting market trend movements and to generate buy-hold-sell signals that assist investors in
adjusting their portfolio allocations.
The studies above utilize historical information and technical indicators to detect and describe
the market trend up to date. However, no prediction of the market trend into the future has been
embedded into the portfolio optimization model or the portfolio rebalance strategy. In the era of
big data, machine learning and artificial intelligence techniques, such as neural network, linear and
logistic regression models, and random forest, have been widely and deeply applied in the financial
J. Risk Financial Manag. 2020, 13, 155 3 of 20
industry for price forecasting, market pattern recognition, and movement prediction. An excellent
survey paper by Thawornwong and Enke (2004) reviews different neural network approaches used
in 45 journal articles for stock returns forecasting. Chen et al. (2008) propose a dynamic proportion
portfolio insurance (DPPI) strategy based on the popular constant proportion portfolio insurance
(CPPI) strategy. The constant multiplier in CPPI is generally regarded as the risk multiplier. Since the
market changes constantly, we think that the risk multiplier should change according to market
conditions. This research identifies risk variables related to market conditions. Ko and Lin (2008)
introduce a resource allocation neural network model to optimize the investment weight of a portfolio.
This model will dynamically adjust the investment weight as a basis of 100% of the sum of all of
the asset weights in the portfolio. The experimental results demonstrate the feasibility of optimal
investment weights and the superiority of ROI of the buy-and-hold trading strategy compared with
the benchmark Taiwan Stock Exchange (TSE). Freitas et al. (2009) present a new prediction-based
portfolio optimization model that can capture short-term investment opportunities, which utilizes
the neural network to predict stock returns and derive a risk measure based on the prediction errors.
Chen et al. (2010) describe a decision-making model of dynamic portfolio optimization for adapting to
the change in stock prices based on an evolutionary computation method known as genetic network
programming (GNP). The proposed model, making use of the information from technical indices and
candlestick chart, is trained to generate portfolio investment advice. Within the framework of Bayesian
analysis, Zhou et al. (2014) construct portfolios with out-of-sample return forecasting based on the
latent threshold dynamic models by considering the dependencies among the sparse factors.
In a more recent study, Ji et al. (2019) propose a multi-period dynamic portfolio optimization
framework that allows the investor to adjust his or her risk attitude (i.e., risk-aversion coefficient)
by fusing the market trend movement information predicted by machine learning models using a
set of technical indicators as the input features. The proposed framework consists of two steps:
first, a set of technical indicators (e.g., moving averages, momentum, relative strength index)
generated from a market index (e.g., S&P 500) will feed the machine learning classification models
(e.g., logistic regression, support vector machines) to predict the market movement (e.g., going up
or down). Secondly, by adjusting the risk-aversion coefficient according to the predicted market
movement, the investor will solve a mean-risk portfolio optimization model to obtain the portfolio
weights and carry the portfolio into the next period. They employ Gini’s Mean Difference as the risk
measure in the portfolio optimization. Our paper is an extension of the work by Ji et al. (2019), with
significant improvements from the following three perspectives:
1. More flexible selection of the risk-aversion coefficient. In Ji et al. (2019), they assume that the
risk-aversion coefficient is selected from a finite and ordered set that is pre-determined by
the investor. The selection of the risk-aversion coefficient is limited within this prescribed set and
is only allowed to change according to its adjacent values. In this study, we modify the objective
function of the mean-risk optimization model into a normalized version, so that the predicted
probability of market movement from the machine learning models can be directly incorporated
as an input of the risk-aversion coefficient, which alleviates the complication of specifying a
prescribed set.
2. More technical indicators are used to train the machine learning models. Ji et al. (2019) employ
9 different technical indicators to feed the machine learning classification models, while we
will consider an extensive set of 14 technical indicators with a total of 37 features or predictors
generated by the different parametric settings of those indicators.
3. More comprehensive empirical tests are conducted to derive numerical insights. Using the rolling-horizon
approach, Ji et al. (2019) conduct numerical tests with a horizon of 156 periods (3 years), with 104
periods in each rolling-window for in-sample training and portfolio optimization, and 52 periods
(1 year) for out-of-sample performance evaluation. In this study, we carry out the empirical tests
with a longer horizon of 1252 periods (24 years from 1995 to 2018), with 260 periods (5 years) in
each rolling-window and 992 periods (19 years) for the out-of-sample performance evaluations.
J. Risk Financial Manag. 2020, 13, 155 4 of 20
The remainder of this paper is organized as follows. Section 2 introduces the Mean-Gini model
using Gini’s Mean Difference as the risk measure, the employed technical indicators and machine
learning classification models. The machine learning integrated portfolio rebalance framework is
established in Section 3. The results of empirical studies are reported in Section 4. Section 5 concludes
the paper.
2. Preliminaries
To be self-contained, we will revisit the three key parts to establish the machine learning integrated
portfolio rebalance framework. Section 2.1 reviews the Gini’s Mean Difference (GMD) and Mean-Gini
portfolio model. Section 2.2 illustrates the 14 technical indicators employed in our study. Section
2.3 briefly introduces two machine learning approaches, that is, logistic regression (LR) and extreme
gradient boosting (XGBoost).
I
Rj = ∑ rij wi (1)
i =1
I
R= ∑ µ i wi . (2)
i =1
The Gini’s Mean Difference (GMD) is defined as one half of the mean absolute difference between
all pairs of realizations of the portfolio return Yitzhaki (1982). We let the Gini’s Mean Difference be
denoted by G, and it can be formally formulated as follows:
J −1 J J −1 J I
1 1
G=
J ( J − 1) ∑∑
′
| R j − R j′ | =
J ( J − 1) ∑∑
′
| ∑ wi (rij − rij′ )| . (3)
j =1 j > j j =1 j > j i =1
J. Risk Financial Manag. 2020, 13, 155 5 of 20
Employing the mean return (R) as the reward measure and the GMD (G) as the risk measure,
the Mean-Gini model can be formulated in the form of maximizing the risk-adjusted mean return.
max R − αG (4)
I
s.t. R= ∑ µ i wi , (5)
i =1
J J
1
G=
J ( J − 1) ∑ ∑ R jj′ , (6)
j =1 j ′ 6 = j
R jj′ ≥ R j − R j′ , j, j′ = 1, . . . , J; j 6= j′ (7)
′ ′
R jj′ ≥ 0 , j, j = 1, . . . , J; j 6= j (8)
I
∑ wi = 1 , (9)
i =1
wi ≥ 0 , i = 1, . . . , N. (10)
R − Rmin G − Gmin
NMG: max λ − (1 − λ ) (11)
Rmax − Rmin Gmax − Gmin
s.t. (5) − (10),
where R and G represents the expected return and Gini’s Mean Difference of the constructed portfolio,
respectively. Gmin denotes the minimal GMD, which can be obtained by minimizing GMD as a single
objective without constraints imposed on expected return. Rmin denotes the minimal expected return
corresponding to the portfolio with Gmin . Rmax and Gmax represent the maximal expected return and
GMD when solving the model with the single objective of maximizing the expected return with no
R− Rmin
restrictions on the risk measure GMD. After the min-max normalization, the two terms Rmax −R min
G − Gmin
and Gmax − Gmin will range from 0 to 1. In addition, we use the weighted coefficient λ and 1 − λ
associated with the return and risk objectives, respectively, where λ ∈ [0, 1] is a user-defined parameter
representing the probability of the market going up. When λ = 1, that is, the probability of the market
going up is 1, then the NMG model reduces to the form of maximizing the expected return solely,
which reflects the risk-seeking attitude of the investor during an upward trend. When λ = 0, that
J. Risk Financial Manag. 2020, 13, 155 6 of 20
is, the probability of the market going down is 1, then the NMG model is equivalent to minimizing
the risk measure GMD, which captures the risk-averse preference during a downward trend. By
adopting the risk-aversion coefficient λ with a probability interpretation, it allows us to integrate
this (predicted) probability obtained by machine learning classification models for predicting the
movement of the market.
Table 1. Cont.
where p( X ) = Pr(Y = 1| x1 , ..., xm ) represents the probability that market index goes up.
This probability p( X ) can be used as a direct input value for the risk-aversion coefficient λ in the NMG
model (11).
Based on probit function, we can get the following equation
p( X ) m
= e β 0 + ∑ i =1 β i x i , (13)
1 − p( X )
p( X )
where the 1− p( X ) is called odds. The value of odds ranges from 0 to ∞. These odds indicate the
likelihood that the market goes up over that of market goes down. By taking the logarithm on both
sides of the odds equation, we can get the following function in the logit format.
m
p( X )
log = β 0 + ∑ β i xi . (14)
1 − p( X ) i =1
applications (Chen and Guestrin 2016). Considering a data set with n observations and m predictors,
a tree model uses K additive functions to build a model.
K
ŷi = ∑ f k ( x i ), f k ∈ F , (15)
k =1
where
1
Ω( f ) = γT + λ kwk .
2
The regularization term Ω is used to penalize the model’s complexity and to avoid over-fitting.
The logistic loss is computed as:
Unlike logistic regression with a clear and explicit equation to calculate the probability and
interpret the relationship between the target variable and predictors, the results of XGBoost are
generated from a collective set of classification trees.
The proposed framework encompasses two phases. In the predictive modeling, the historical
information (including open, low, high, close prices and volume) of a market index such as S&P 500
will be collected and used to generate the technical indicators, which will be treated as the predictors
J. Risk Financial Manag. 2020, 13, 155 9 of 20
or features to the machine learning models (e.g., logistic regression, XGBoost) to predict the market
movement trend. The predicted probabilities of market going up will then be utilized to represent
or adjust the risk-aversion coefficient λ, which is an input parameter of the portfolio optimization
modeling phase. In the portfolio optimization models, we collect the historical prices of assets or stocks
in the market (e.g., S&P 500), and compute the returns. After solving the portfolio optimization models
with the risk-aversion adjustment, we apply the obtained portfolio weights into the future market.
In a multi-period setting with a finite horizon, to build the predictive models and conduct the
out-of-sample performance tests of the generated portfolios, we adopt a rolling horizon procedure
similar to DeMiguel et al. (2009) and proceed with our portfolio rebalance approach as follows:
1. A specific market is selected (e.g., S&P 500), historical information of the market index and a set
of assets that belong to that market are collected. A window of τ periods are used as in-sample
periods to build the machine learning models in a cross-validation manner and to construct the
NMG portfolios. In our tests, τ is selected to be 260 that covers weekly returns over 5 years.
2. Within the in-sample periods up to time period t, the 14 technical indicators (i.e., SMA, WMA,
EMA, MACD, RSI, ADX, CCI, SMI, EMV, MFI, CMF, VWAP, BBands and SAR) are computed from
the index value and are fed to the two machine learning models (i.e., LR, XGBoost) to obtain the
market movement with predicted probabilities λt+1 . The tuning parameters of machine learning
models are selected via cross-validation. Using the new or updated risk-aversion coefficient,
we solve the NMG model to obtain portfolio weights within the training window.
3. We carry out the rolling horizon procedure each time by adding the data of the next week (period)
in the out-of-sample periods and dropping the data of the earliest week from the in-sample
periods. The technical indicators, machine learning models results, and portfolio optimization
models are updated on a weekly basis.
4. We repeat this procedure until the end of the selected dataset, which generates T − τ portfolios.
The weight of asset i in time period t is denoted by wit , for t = τ, . . . , T − 1. Holding the portfolio
weights wit for one week gives the out-of-sample return at time t + 1 : Rt+1 = ∑iI=1 wit ri,t+1 ,
where ri,t+1 denotes the return of asset i in out-of-sample period t + 1. We then evaluate the
out-of-sample portfolio performance and compare them to other benchmarks.
We emphasize that our proposed framework is a general framework that can be easily extended
to employ various types of technical indicators, machine learning classification models with predicted
probabilities, and mean-risk portfolio optimization models, not limited to the ones presented in
the current paper. We refer interested readers to Colby (2002), Cervelló-Royo and Guijarro (2020)
and Fabozzi et al. (2010) for more choices of technical indicators, machine learning algorithms, and
mean-risk portfolio models.
4. Computational Tests
In this section, we carry out a series of tests with empirical data to evaluate the portfolio
performance generated by the machine learning integrated Mean-Gini portfolio rebalance framework.
Section 4.1 introduces the data sets and experimental design. Section 4.2 describes the metrics to
evaluate portfolio performances. Section 4.3 provides the results of machine learning models and
derives insights regarding the out-of-sample performance of the risk-aversion adjusted portfolios.
of the 26 assets are listed in Table 2. The adjusted close prices were used to compute the technical
indicators. We selected the 25 risky assets in Table 2 with three factors—(i) The selected assets have no
missing values within the studied time horizon; (ii) The selected assets are not high volatile assets,
with volatility lower than 0.5; (iii) The selected assets are diversified to reflect the market index. The
selected 25 assets cover 9 out of 11 S&P 500 sectors. The selected 25 assets remained in the S&P 500
index during the testing period. This could potentially lead to a survivor bias and a possible slightly
skewed over-performance of the portfolios when compared to the S&P index. However, we note that
the comparisons among the constructed portfolios are valid considering they use the same dataset. In
addition, similar empirical evaluations of the asset universe have been commonly employed in the
literature (see, e.g., Disatnik and Benninga 2007 and Urbán and Ormos 2012).
We conducted the tests following the rolling-horizon approach with a training window for 260
periods (5 years). In each window, we built the logistic regression and XGBoost models, and predicted
the probability of the market going up in the 261st period. The predicted probability will be used as
the risk-aversion coefficient λ in the NMG model to construct the Mean-Gini portfolio. We carried the
portfolio weights into the 261st period and obtained a portfolio return and validated the prediction
accuracy of the machine learning models. We then dropped the data of the 1st week and added the
data of the 261st week to build the second training window and repeated the training of the machine
learning models and constructing Mean-Gini portfolios. We repeated this procedure until the end of
the entire dataset.
For comparison purposes, besides the two Mean-Gini portfolios constructed via logistic regression
and XGBoost with risk-aversion adjustment, we used the following four benchmarks: (1) Mean-Gini
J. Risk Financial Manag. 2020, 13, 155 11 of 20
portfolio with fixed risk-aversion coefficient λ = 0.5; (2) The equal weights portfolio, that is, the capital
is equally assigned into the 26 assets over all testing periods; (3) The S&P 500 market index; (4) The
classical minimal variance (MinVar) portfolio (i.e., a portfolio that minimizes the variance of returns).
We note that there are many candidates on the mean-variance efficient frontier to be selected, we pick
this MinVar as a baseline for comparison.
The R software was used to compute the technical indicators from the S&P 500 index and build
the machine learning models via a cross-validation procedure to generate the market movement
predictions. The AMPL modeling language was used to formulate the NMG and MinVar portfolio
optimization problem, and each problem instance was solved by the commercial solver Cplex with
version 12.6. All tests were conducted on a 64-bit desktop with Intel(R) Core(TM) i5-6500 processor,
running at 3.2GHz CPU and with 8GB RAM.
T −1 I
1
Ra =
T−τ ∑ ∑ wit ri,t+1 . (18)
t = τ i =1
T −1 T
1 j j
Gout =
( T − τ − 1)( T − τ ) ∑ ∑
′
| R t − R t ′ |. (20)
t=τ t >t
Ra Ra
SR = = s . (21)
σ T −1
1
T − τ −1 ∑ ( R t +1 − R a )2
t=τ
T −1
Rc = ∏ (1 + Rt+1 ) − 1. (22)
t=τ
CCI
MFI(n=5)
SMA(n=5)
SMI(n=5)
MFI(n=3)
RSI(n=3)
SAR
WMA(n=10)
LowPrice
MidBand(n=10)
HighPrice
The performance of portfolios (LR and XGBoost) generated by our proposed machine learning
integrated portfolio rebalance framework shows superior performance compared to the other four
benchmark portfolios in terms of return measures, that is, average return, cumulative return,
and annualized return. Suppose the investor is profit-driven, then the LR and XGBoost portfolios are
convincing choices to be adopted. The XGBoost portfolios display the best performance among all
portfolios with respect to average return (0.35%), cumulative return (1511.73%) and annualized return
(15.76%). The LR portfolios have a close performance to the XGBoost portfolios, with an average return
of 0.33%, cumulative return of 1390.65% and an annualized return of 15.28%. In terms of cumulative
return at the end of the testing periods, XGBoost (resp. LR) portfolios is 1.31, 1.63, 21.70 and 40.91
(resp. 1.12, 1.42, 19.88 and 37.55) times better than λ = 0.5, Equal Weights, S&P 500 index, and MinVar
portfolio, respectively.
J. Risk Financial Manag. 2020, 13, 155 14 of 20
The MinVar portfolio has the best performance with respect to the out-of-sample risk measures
such as standard deviation and Gini’s Mean Difference. The MinVar portfolio is the most conservative
and diversified portfolio. MinVar portfolio puts weights into all 26 assets across all 992 periods, while
focusing more on risk-free assets. Each constructed MinVar portfolio invests more than 90% of the
capital into the risk-free asset, leading to very low values of risk measures (e.g., standard deviation at
0.04% and GMD at 0.02%), as well as low return measures (e.g., average return at 0.03%, cumulative
return at 36.07% and annualized return 1.63%). The lowest standard deviation of MinVar leads to its
highest Sharpe ratio at 0.8820, which dominates all 5 other portfolios. Excluding the MinVar portfolio,
the LR portfolio has the highest Sharpe ratio. The XGBoost portfolio does not beat the Equal Weights
portfolios with respect to Sharpe ratio (0.0948 vs. 0.0955), but it still beats the λ = 0.5 portfolio (0.0878)
and S&P 500 (0.0335). The performance of the portfolios is consistent in terms of standard deviation
and GMD, the MinVar has the lowest value, followed by Equal Weights, S&P 500, λ = 0.5, then by LR
and XGBoost.
From Figure 4, the LR and XGBoost portfolios show dominance over the benchmarks S&P 500
and MinVar portfolio across the testing periods. The dominance relationship becomes more significant
starting in 2009, after the financial crisis in 2008. The portfolios generated by our machine learning
integrated framework with risk-aversion adjustment provide convincing results, by outperforming
the one without risk-aversion adjustment (λ = 0.5), and the other three classical benchmarks (Equal
Weights, S&P 500 and MinVar) in terms of average return, cumulative return and annualized return,
which also display great performance with respect to Sharpe ratio.
XGBoost). Within a rolling-horizon procedure, we conduct an extensive set of empirical tests to assess
the prediction results of the machine learning models and evaluate the out-of-sample performance of
the resulting portfolios. We find that XGBoost model provides better performance prediction. The LR
and XGBoost portfolios generated by our proposed framework show great performance in terms of
average return, cumulative return and annualized return compared to the three other benchmarks.
For future research, we aim to expand the proposed framework to the index tracking optimization
problem (see for example, García et al. 2018a) that utilizes the predictive modeling power to detect the
market movement trend for better tracking performance. Moreover, we would also like to incorporate
more practical constraints when building the mean-risk portfolio optimization models, such as the
bound and cardinality constraints (see Guijarro and Tsinaslanidis 2019), and evaluate the performance
of the proposed framework with a larger as well as a more comprehensive dataset.
Author Contributions: All authors made important contribution to this paper. Conceptualization, R.J. and K.-C.C.;
methodology, R.J. and K.-C.C.; software, Z.J. and R.J. ; validation, Z.J., R.J. and K.-C.C.; formal analysis, Z.J. and
R.J.; investigation, R.J. and K.-C.C.; resources, Z.J.; data curation, Z.J..; writing—original draft preparation, Z.J.
and R.J.; writing—review and editing, R.J. and K.-C.C.; visualization, Z.J.; supervision, R.J.; project administration,
R.J. All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.
Conflicts of Interest: The authors declare no conflict of interest.
1. Simple Moving Average (SMA): SMA is defined as a simple linear (equally-weighted) rolling
mean of the closing prices of an asset in the past n periods. We let the prices be denoted by
PM , PM−1 , PM−(n−1) .
2. Weighted Moving Average (WMA): WMA is an adapted version of SMA, where the weight
assigned to each period is not identical, but decreases in an arithmetical progression. In an
n-period WMA calculation, the latest period has weight n, followed by the second latest period’s
weight n − 1, until down to one.
3. Exponential Moving Average (EMA): Compared to the linear decreasing of weight in WMA,
EMA is computed with the weighting for each older datum decreasing exponentially in an
iterative procedure.
4. Moving Average Convergence/Divergence (MACD): MACD is a classical trend-following
momentum indicator of the exponential moving average (EMA) of a stock or index that is
used to identify short-term momentum. More specifically, MACD is calculated by subtracting the
long-term EMA from the short-term EMA to obtain an intermediate trend line. An EMA is then
plotted over the intermediate line to identify the buy or sell signal of the asset or the index. When
the resulting MACD falls below the signal line, it is a bearish signal, which indicates that it may be
time to sell. Conversely, when the MACD rises above the signal line, the indicator gives a bullish
signal, which suggests that the price of the asset is likely to experience upward momentum.
5. Relative Strength Index (RSI): RSI shows the strength or speed of the asset price by means of the
comparison of the individual upward or downward movements of the consecutive closing prices.
It is computed as the ratio of recent upward price movements to the absolute price movements.
For each time period, an upward movement U (i.e., if PM − PM−n > 0) or a downward movement
D (i.e., if PM − PM−n < 0) is characterized depending on the relative difference between the
current price PM and the previous price PM−n .
6. Average Directional Movement Index (ADX): The ADX is a combination of the positive directional
indicator (denoted by + DI) and the negative directional indicator (denoted by − DI) with a
J. Risk Financial Manag. 2020, 13, 155 16 of 20
n −1 h i
EMA ∑ α(1 − α)i PM−i , α = 2/(n + 1)
i =0
MACD DIF = EMA(close, n1 ) − EMA(close, n2 )
MACD = EMA( DIF, n3 )
100
RSI 100 − EMA(U,n) , U & D: upward and downward movements
1+ EMA( D,n)
Volume/10000
Box Ratio = Phigh − Plow
Midpoint Move
EMV = Box Ratio
high low close
MFI P = P +P 3 +P
Raw Money Flow = P × Volume
n− period Positive Money Flow
Money Flow Ratio = n− period Negative Money Flow
MFI = 100 − 1+ Money100
Flow Ratio
( Pclose − Plow )−( Phigh − Pclose )
CMF Money Flow Multiplier = Phigh − Pclose
Money Flow Volume = Money Flow Multiplier × Volume
n
Money Flow Volume
CMF = ∑1 ∑n Volume
1
n −1
∑ volume M−i × PM−i
i =0
VWAP n −1
∑ volume M−i
i =0
high low close
BBands P = P +P 3 +P
Mid Band = SMA( P)
U pper Band = Mid Band + F × σ( P), σ( P): standard deviation of P
Lower Band = Mid Band − F × σ ( P)
SAR RSAR = Prior SAR + Prior AF × ( Prior EP − Prior SAR), AF: Acceleration Factor
FSAR = Prior SAR − Prior AF × ( Prior SAR − Prior EP), EP: Extreme Points
J. Risk Financial Manag. 2020, 13, 155 18 of 20
References
Ahmadi-Javid, Amir. 2012. Entropic value-at-risk: A new coherent risk measure. Journal of Optimization Theory
and Applications 155: 1105–23. [CrossRef]
Ahn, Dong-Hyun, Jennifer Conrad, and Robert Dittmar. 2003. Risk adjustment and trading strategies. Review of
Financial Studies 16: 459–85. [CrossRef]
Artzner, Philippe, Freddy Delbaen, Jean-Marc Eber, and David Heath. 1999. Coherent measures of risk.
Mathematical Finance 9: 203–28. [CrossRef]
Basel Committee on Banking Supervision. 2004. International Convergence of Capital Measurement and Capital
Standards: A Revised Framework. Basel: BIS.
Brock, William, Josef Lakonishok, and Blake LeBaron. 1992. Simple technical trading rules and the stochastic
properties of stock returns. The Journal of Finance 47: 1731–64. [CrossRef]
Cervelló-Royo, Roberto, and Francisco Guijarro. 2020. Forecasting stock market trend: a comparison of machine
learning algorithms. Finance, Markets and Valuation 6: 37–49.
Chen, Jiah-Shing, Chia-Lan Chang, Jia-Li Hou, and Yao-Tang Lin. 2008. Dynamic proportion portfolio insurance
using genetic programming with principal component analysis. Expert Systems with Applications 35: 273–78.
[CrossRef]
Chen, Tianqi, and Carlos Guestrin. 2016. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd Acm
Sigkdd International Conference on Knowledge Discovery and Data Mining. New York: ACM. pp. 785–94.
Chen, Yan, Shingo Mabu, and Kotaro Hirasawa. 2010. A model of portfolio optimization using time adapting
genetic network programming. Computers & Operations Research 37: 1697–707.
Colby, Robert W. 2002. The Encyclopedia of Technical Market Indicators. New York: McGraw-Hill.
Conrad, Jennifer, and Gautam Kaul. 1998. An anatomy of trading strategies. Review of Financial Studies 11:
489–519. [CrossRef]
Covel, Michael. 2004. Trend Following: How Great Traders Make Millions in Up or Down Markets. Upper Saddle
River: FT Press.
Covel, Michael. 2009. Trend Following: Learn to Make Millions in Up Or Down Markets. Upper Saddle River:
FT Press.
DeMiguel, Victor, Lorenzo Garlappi, Francisco Nogales, and Raman Uppal. 2009. A generalized approach
to portfolio optimization: Improving performance by constraining portfolio norms. Management Science 55:
798–812. [CrossRef]
Disatnik, David, and Simon Benninga. 2007. Shrinking the covariance matrix. The Journal of Portfolio
Management 33: 55–63. [CrossRef]
Duffie, Darrell, and Jun Pan. 1997. An overview of value at risk. The Journal of Derivatives 4: 7–49. [CrossRef]
Fabozzi, Frank, Dashan Huang, and Guofu Zhou. 2010. Robust portfolios: Contributions from operations research
and finance. Annals of Operations Research 176: 191–220. [CrossRef]
Fama, Eugene., and Marshall Blume. 1966. Filter rules and stock-market trading. Journal of Business 39: 226–41.
[CrossRef]
Freitas, Fabio, Alberto De Souza, and Ailson de Almeida. 2009. Prediction-based portfolio optimization model
using neural networks. Neurocomputing 72: 2155–70. [CrossRef]
Gaivoronski, Alexei, and Georg Pflug. 2004. Value-at-Risk in portfolio optimization: Properties and computational
approach. The Journal of Risk 7: 1–31. [CrossRef]
García, Fernando, Francisco Guijarro, and Javier Oliver. 2018a. Index tracking optimization with cardinality
constraint: A performance comparison of genetic algorithms and tabu search heuristics. Neural Computing and
Applications 30: 2625–41. [CrossRef]
García, Fernando, Francisco Guijarro, Javier Oliver, and Rima Tamošiūnienė. 2018b. Hybrid fuzzy neural network
to predict price direction in the German DAX-30 index. Technological and Economic Development of Economy 24:
2161–78. [CrossRef]
Geweke, John, and Gianni Amisano. 2010. Comparing and evaluating bayesian predictive distributions of asset
returns. International Journal of Forecasting 26: 216–30. [CrossRef]
Gorgulho, António, Rui Neves, and Nuno Horta. 2011. Applying a GA kernel on optimizing technical analysis
rules for stock picking and portfolio composition. Expert systems with Applications 38: 14072–85. [CrossRef]
J. Risk Financial Manag. 2020, 13, 155 19 of 20
Guijarro, Francisco, and Prodromos Tsinaslanidis. 2019. A surrogate similarity measure for the mean-variance
frontier optimisation problem under bound and cardinality constraints. Journal of the Operational Research Society
1–16. [CrossRef]
Hu, Hongping, Li Tang, Shuhua Zhang, and Haiyan Wang. 2018. Predicting the direction of stock markets using
optimized neural networks with google trends. Neurocomputing 285: 188–95. [CrossRef]
Ji, Ran, Miguel Lejeune, and Srinivas Prasad. 2017a. Dynamic portfolio optimization with risk-aversion adjustment
utilizing technical indicators. Paper presented at the 2017 20th International Conference on Information Fusion
(Fusion), Xi’an, China, July 10–13. Piscataway: IEEE, pp. 1787–94.
Ji, Ran, Miguel Lejeune, and Srinivas Prasad. 2017b. Properties, formulations, and algorithms for portfolio
optimization using mean-gini criteria. Annals of Operations Research 248: 305–43. [CrossRef]
Ji, Ran, Miguel Lejeune, and Srinivas Prasad. 2018. Interactive portfolio optimization using Mean-Gini criteria.
In Financial Decision Aid Using Multiple Criteria. Berlin and Heidelberg: Springer, pp. 49–91.
Ji, Ran, K. C. Chang, and Zhenlong Jiang. 2019. Risk-aversion adjusted portfolio optimization with predictive
modeling. Paper presented at the 2019 22th International Conference on Information Fusion (FUSION), Ottawa,
ON, Canada, July 2–5. Piscataway: IEEE, pp. 1–8.
Ko, Po-Chang, and Ping-Chen Lin. 2008. Resource allocation neural network in portfolio selection. Expert Systems
with Applications 35: 330–37. [CrossRef]
Konno, Hiroshi, and Hiroaki Yamazaki. 1991. Mean-absolute deviation portfolio optimization model and its
applications to Tokyo stock market. Management Science 37: 519–31. [CrossRef]
Kwon, Ki-Yeol, and Richard Kish. 2002. Technical trading strategies and return predictability: NYSE. Applied
Financial Economics 12: 639–53. [CrossRef]
Lo, Andrew, Harry Mamaysky, and Jiang Wang. 2000. Foundations of technical analysis: Computational
algorithms, statistical inference, and empirical implementation. The Journal of Finance 55: 1705–70. [CrossRef]
Markowitz, Harry. 1952. Portfolio selection. Journal of Finance 7: 77–91.
Markowitz, Harry. 1959. Portfolio Selection: Efficient Diversification of Investments. Wiley: New York.
Markowitz, Harry, Peter Todd, Ganlin Xu, and Yuji Yamane. 1993. Computation of mean-semivariance efficient
sets by the critical line algorithm. Annals of Operations Research 45: 307–17. [CrossRef]
Ni, Li-Ping, Zhi-Wei Ni, and Ya-Zhuo Gao. 2011. Stock trend prediction based on fractal feature selection and
support vector machine. Expert Systems with Applications 38: 5569–76. [CrossRef]
Ogryczak, Włodzimierz, and Andrzej Ruszczyński. 1999. From stochastic dominance to mean-risk models:
Semi-deviations as risk measures. European Journal of Operational Research 116: 33–50. [CrossRef]
Ogryczak, Włodzimierz, and Andrzej Ruszczyński. 2001. On consistency of stochastic dominance and
mean-semideviations models. Mathematical Programming 89: 217–32. [CrossRef]
Ringuest, Jeffrey, Samuel Graves, and Randy Case. 2004. Mean-Gini analysis in R&D portfolio selection.
European Journal of Operational Research 154: 157–69.
Rockafellar, Tyrrell, and Stanislav Uryasev. 2000. Optimization of conditional Value-at-Risk. Journal of Risk 2:
21–42. [CrossRef]
Schwager, Jack. 1993. Market Wizards: Interviews with Top Traders. New York: Collins.
Schwager, Jack. 1995. The New Market Wizards: Conversations with America’s Top Traders. New York: Wiley.
Sehgal, Ruchika, and Aparna Mehra. 2017. Worst-case analysis of Gini mean difference safety measure. Journal of
Industrial & Management Optimization 13. [CrossRef]
Shalit, Haim, and Doron Greenberg. 2013. Hedging with stock index options: A Mean-Extended Gini approach.
Journal of Mathematical Finance 3: 119–29. [CrossRef]
Shalit, Haim, and Shlomo Yitzhaki. 1984. Mean-Gini, portfolio theory, and the pricing of risky assets. The Journal
of Finance 39: 1449–68. [CrossRef]
Thawornwong, Suraphan, and David Enke. 2004. Forecasting stock returns with artificial neural networks.
In Neural Networks in Business Forecasting. Hershey: IGI Global, pp. 47–79.
Urbán, Andrásand Mihály Ormos. 2012. Performance analysis of equally weighted portfolios: USA and Hungary.
Acta Polytechnica Hungarica 9: 155–68.
Yitzhaki, Shlomo. 1982. Stochastic dominance, mean variance and Gini’s mean difference. American Economic
Review 72: 178–85.
Yitzhaki, Shlomo. 1983. On an extension of the Gini inequality index. International Economic Review 24: 617–28.
[CrossRef]
J. Risk Financial Manag. 2020, 13, 155 20 of 20
Zhou, Xiaocong, Jouchi Nakajima, and Mike West. 2014. Bayesian forecasting and portfolio decisions using
dynamic dependent sparse factor models. International Journal of Forecasting 30: 963–80. [CrossRef]
Zhu, Shushang, Duan Li, and Shouyang Wang. 2009. Robust portfolio selection under downside risk measures.
Quantitative Finance 9: 869–85. [CrossRef]
c 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access
article distributed under the terms and conditions of the Creative Commons Attribution
(CC BY) license (http://creativecommons.org/licenses/by/4.0/).