• Search in book...
• Toggle Font Controls
88 ONLINE MOVING AVERAGE REVERSION
Without detailing the calculation,
we list the growth of OLMAR in different
toy markets in Table 11.2. Clearly, OLMAR performs much better than PAMR in
multiperiod mean reversion, but PAMR performs better than OLMAR in single-period
reversion. Further empirical evaluations in Part IV show that the markets are more
11.2 Formulations
In this chapter, we adopt two types of moving average. The ﬁrst, the so-called simple
moving average (SMA), truncates the historical prices via a window and calculates
its arithmetical average:
SMA
t
(w) =
1
w
t
i=tw+1
p
i
,
where w denotes the window size and the summation is element-wise. Although
we can enlarge the window size such that SMA can include more historical price
relatives, the empirical evaluations in Part IV show that as the window size increases,
its performance drops.
To consider entire price relatives rather than a window, the second type, exponen-
tial movingaverage(EMA), adopts all historicalprices,and each priceisexponentially
weighted,
EMA
1
(α) = p
1
EMA
t
(α) = αp
t
+(1 α)EMA
t1
(α)
= αp
t
+(1 α)αp
t1
+(1 α)
2
αp
t2
+···+(1 α)
t1
p
1
,
where α (0, 1) denotes a decaying factor.
To this end, we can calculate the predicted price relative vector following the idea
of the so-called moving average reversion (MAR). Based on the two types of moving
average, we can infer two types of MAR.
Moving Average Reversion: MAR-1
˜
x
t+1
(w) =
SMA
t
(w)
p
t
=
1
w
p
t
p
t
+
p
t1
p
t
+···+
p
tw+1
p
t
=
1
w
1 +
1
x
t
+···+
1
w2
i=0
x
ti
,
(11.1)
where w is the window size and
denotes the element-wise product.
We calculate OLMAR’s growth using Algorithm 11.1. As the market sequences repeat themselves,
OLMAR will ﬁnally stabilize.
T&F Cat #K23731 — K23731_C011 — page 88 — 9/30/2015 — 16:44
FORMULATIONS 89
Moving Average Reversion: MAR-2
˜
x
t+1
(α) =
EMA
t
(α)
p
t
=
αp
t
+(1 α)EMA
t1
(α)
p
t
= α1 +(1 α)
EMA
t1
(α)
p
t1
p
t1
p
t
= α1 +(1 α)
˜
x
t
x
t
,
(11.2)
where α (0, 1) denotes the decaying factor and the operations are all element-wise.
Based on the expected price relative vector in Equations 11.1 and 11.2, OLMAR
further adopts the idea of an effective online learning algorithm, that is, passive–
aggressive (PA) (Crammer et al. 2006) learning, to exploit the MAR. Generally
proposed for classiﬁcation, PA passively keeps the previous solution if the classi-
ﬁcation is correct, while aggressively approaches a new solution if the classiﬁcation
is incorrect. After formulating the proposed OLMAR, we solve its closed-form update
and design speciﬁc algorithms.
The proposed formulation, OLMAR, is to exploit MAR via PA online learning.
The basic idea is to maximize the expected return b·
˜
x
t+1
and keep last portfolio
information via a regularization term. Thus, we follow the similar idea of PAMR (Li
et al. 2012) and formulate an optimization as follows.
Optimization Problem: OLMAR
b
t+1
= arg min
b
m
1
2
b b
t
2
s. t. b ·
˜
x
t+1
.
Note that we adopt expected return rather than expected log return. According to
Helmbold et al. (1998), to solve the optimization with expected log return, one can
adopt the ﬁrst-order Taylor expansion, which is essentially linear. Such discussions
are illustrated in Sections 9.2 and 10.2.
The above formulation explicitly reﬂects the basic idea of the proposed OLMAR.
On the one hand, if its constraint is satisﬁed, that is, the expected return is higher than
a threshold, then the resulting portfolio becomes equal to the previous portfolio. On
the other hand, if the constraint is not satisﬁed, then the formulation will ﬁgure out
a new portfolio such that the expected return is higher than the threshold, while the
new portfolio is not far from the last one.
Since OLMAR follows the same learning principle as PAMR, their formulations
are similar. However, the two formulations are essentially different. In particular,
PAMR’s core constraint (i.e., b·x
t
) adopts the raw price relative and has a dif-
ferent inequality sign. After a certain transformation, PAMR may be written in a
similar form, as shown in Table 11.1. However, the prediction functions are different
(i.e., OLMAR adopts multiperiod mean reversion, while PAMR exploits single-period
mean reversion).
T&F Cat #K23731 — K23731_C011 — page 89 — 9/30/2015 — 16:44
90 ONLINE MOVING AVERAGE REVERSION
11.3 Algorithms
The preceding formulation is thus convex and straightforward to solve via convex
optimization (Boyd and Vandenberghe 2004). We now derive the OLMAR solution
as illustrated in Proposition 11.1.
Proposition 11.1 The solution of OLMAR without considering the nonnegativity
constraint is
b
t+1
= b
t
+λ
t+1
(
˜
x
t+1
−¯x
t+1
1),
where ¯x
t+1
=
1
m
(1 ·
˜
x
t+1
) denotes the average predicted price relative, and λ
t+1
is
the Lagrangian multiplier calculated as
λ
t+1
= max
"
0,
b
t
·
˜
x
t+1
˜
x
t+1
−¯x
t+1
1
2
#
.
Proof The proof can be found in Appendix B.4.1.
Following PAMR and CWMR, the above derivation ﬁrst ignores the nonnegativity
constraint (Helmbold et al. 1998). Thus, it is possible that the resulting portfolio
goes out of the portfolio simplex domain. To maintain a proper portfolio, we ﬁnally
Algorithm 11.1: Online portfolio selection with OLMAR.
Input: > 1: Reversion threshold; w 1: Window size; α (0, 1): Decaying
factor; x
n
1
: Market sequence.
Output: S
n
: Cumulative wealth after n periods.
begin
Initialization: b
1
=
1
m
1, S
0
= 1,
˜
x
1
= 1;
for t = 1,...,ndo
Rebalance the portfolio to b
t
t
Calculate daily return and cumulative return: S
t
= S
t1
×(b
t
·x
t
)
Predict next price relative vector:
˜
x
t+1
=
1
w
1 +
1
x
t
+···+
1
w2
i=0
x
ti
MAR-1
α1 +(1 α)
˜
x
t
x
t
MAR-2
Update the portfolio:
b
t+1
= OLMAR(,
˜
x
t+1
, b
t
)
end
end
T&F Cat #K23731 — K23731_C011 — page 90 — 9/30/2015 — 16:44
ANALYSIS 91
Algorithm 11.2: Online Moving Average Reversion: OLMAR(,
˜
x
t+1
, b
t
).
Input: > 1: Reversion threshold;
˜
x
t+1
: Predicted price relatives; b
t
: Current
portfolio.
Output: b
t+1
: Next portfolio.
begin
Calculate the following variables:
¯x
t+1
=
1
˜
x
t+1
m
, λ
t+1
= max
"
0,
b
t
·
˜
x
t+1
˜
x
t+1
−¯x
t+1
1
2
#
Update the portfolio:
b
t+1
= b
t
+λ
t+1
(
˜
x
t+1
−¯x
t+1
1)
Normalize b
t+1
:
b
t+1
= arg min
b
m
b b
t+1
2
end
project the portfolio to the simplex domain (Duchi et al. 2008), which costs linear
time.
To this end, we can design the proposed algorithm based on the proposition.
The proposed OLMAR procedure is demonstrated in Algorithm 11.1, and the OLPS
procedure utilizing the OLMAR algorithm is illustrated in Algorithm 11.2.
11.4 Analysis
The update of OLMAR is straightforward, that is, b
t+1
= b
t
+λ
t+1
(
˜
x
t+1
−¯x
t+1
1).
This second part of the update formula, +λ
t+1
(
˜
x
t+1
−¯x
t+1
1), coincides with the
general form (Conrad and Kaul 1998, Eq. (1)) of return-based momentum strategies,
except the varying λ
t+1
. Intuitively, the update divides assets into two groups by pre-
diction average. For assets in the group with higher predictions than average, OLMAR
increases their proportions; for other assets, OLMAR decreases their proportions. The
transferred proportions are related to the surprise of predictions over their average
value and the nonnegative Lagrangian multiplier. This is consistent with the normal
portfolio selection procedure, that is, to transfer the wealth to assets with a better
prospect to grow.
Clearly, the OLMAR update costs linear time per period with respect to m, and
the normalization step can also be implemented in linear time (Duchi et al. 2008).
To the best of our knowledge, OLMAR’s linear time is no worse than any existing
algorithms, which can be inferred from Table 10.3.
T&F Cat #K23731 — K23731_C011 — page 91 — 9/30/2015 — 16:44
92 ONLINE MOVING AVERAGE REVERSION
11.5 Summary
This chapter proposed a novel online portfolio selection (OLPS) strategy named
online moving average reversion (OLMAR), which exploits moving average rever-
sion (MAR) via online learning algorithms. The approach can solve the problems of
the state of the art caused by the assumption of single-period mean reversion and
achieve satisfying results in real markets. It also runs extremely fast and is suitable
for large-scale real applications.
In future, we will further explore the theoretical aspect of mean reversion and
analyze the behaviors of mean reversion–based portfolios.
T&F Cat #K23731 — K23731_C011 — page 92 — 9/30/2015 — 16:44
• No Comment
..................Content has been hidden....................