The real world is just not a 100% “risk on” or “risk off” world. Most of the time, the best allocation is somewhere in between.
Load historical data for SPY and TLT, and align it, so that dates on both time series match. We also adjust data for stock splits and dividends.
Now we ready to back-test our strategy:
Elapsed time is 0.15 seconds
Elapsed time is 20.84 seconds
SPY
equal.weight
top1
UIS
UISA
Period
Jul2002 - Mar2015
Jul2002 - Mar2015
Jul2002 - Mar2015
Jul2002 - Mar2015
Jul2002 - Mar2015
Cagr
8.74
8.65
13.35
12.42
12.1
Sharpe
0.52
0.96
0.94
1.22
1.19
DVR
0.34
0.83
0.79
1.06
1.05
Volatility
19.78
9.11
14.52
10.06
10
MaxDD
-55.19
-24.91
-17.08
-15.81
-17.17
AvgDD
-1.92
-1.14
-2.13
-1.33
-1.36
VaR
-1.84
-0.88
-1.44
-0.95
-0.94
CVaR
-2.98
-1.3
-2.03
-1.44
-1.44
Exposure
99.97
99.94
97.89
97.26
97.26
models$top1
weight
entry.date
exit.date
nhold
entry.price
exit.price
return
SPY
100
2013-07-31
2013-08-30
30
163.78
158.87
-3.00
SPY
100
2013-08-30
2013-09-30
31
158.87
163.90
3.17
SPY
100
2013-09-30
2013-10-31
31
163.90
171.49
4.63
SPY
100
2013-10-31
2013-11-29
29
171.49
176.57
2.96
SPY
100
2013-11-29
2013-12-31
32
176.57
181.15
2.59
SPY
100
2013-12-31
2014-01-31
31
181.15
174.77
-3.52
TLT
100
2014-01-31
2014-02-28
28
104.95
105.50
0.52
TLT
100
2014-02-28
2014-03-31
31
105.50
106.28
0.74
TLT
100
2014-03-31
2014-04-30
30
106.28
108.50
2.09
SPY
100
2014-04-30
2014-05-30
30
185.52
189.82
2.32
TLT
100
2014-05-30
2014-06-30
31
111.71
111.43
-0.25
SPY
100
2014-06-30
2014-07-31
31
193.74
191.14
-1.34
SPY
100
2014-07-31
2014-08-29
29
191.14
198.68
3.94
TLT
100
2014-08-29
2014-09-30
32
117.46
114.98
-2.11
TLT
100
2014-09-30
2014-10-31
31
114.98
118.22
2.82
TLT
100
2014-10-31
2014-11-28
28
118.22
121.73
2.97
SPY
100
2014-11-28
2014-12-31
33
206.06
205.54
-0.25
TLT
100
2014-12-31
2015-01-30
30
125.42
137.73
9.82
TLT
100
2015-01-30
2015-02-27
28
137.73
129.28
-6.14
TLT
100
2015-02-27
2015-03-11
12
129.28
127.20
-1.61
SPY
equal.weight
top1
UIS
UISA
Period
Jan2014 - Dec2014
Jan2014 - Dec2014
Jan2014 - Dec2014
Jan2014 - Dec2014
Jan2014 - Dec2014
Cagr
14.65
20.49
8.69
19.09
16.77
Sharpe
1.18
3.25
0.74
2.83
2.39
DVR
1
3.16
0.58
2.74
2.29
Volatility
11.25
5.65
10.69
6
6.19
MaxDD
-7.27
-2.67
-5.4
-2.79
-3.72
AvgDD
-1.45
-0.53
-1.89
-0.61
-0.66
VaR
-1.16
-0.58
-1.06
-0.58
-0.63
CVaR
-1.72
-0.78
-1.46
-0.84
-0.92
Exposure
100
100
100
100
100
SPY
equal.weight
top1
UIS
UISA
Period
Jan2010 - Mar2015
Jan2010 - Mar2015
Jan2010 - Mar2015
Jan2010 - Mar2015
Jan2010 - Mar2015
Cagr
14.28
12.89
18.23
16.71
16.02
Sharpe
0.94
1.76
1.22
1.92
1.79
DVR
0.88
1.72
1.19
1.88
1.76
Volatility
15.81
7.11
14.88
8.36
8.66
MaxDD
-18.61
-7.14
-12.03
-6.48
-6.78
AvgDD
-1.71
-0.83
-2.09
-0.97
-1.04
VaR
-1.61
-0.71
-1.46
-0.8
-0.81
CVaR
-2.39
-1
-2.01
-1.19
-1.22
Exposure
100
100
100
100
100
The idea for this Universal Investment Strategy was to develop a strategy which
has an adaptive allocation between 0% and 100% for each ETF depending of the market situation.
The way to calculate the optimum composition is done by calculating which composition
had the maximum Sharpe ratio during an optimized look back period (normally 50-80 days).
During normal market periods, the maximum Sharpe ratio is not at a 100% SPY or
at a 100% TLT allocation, but somewhere in between.
To calculate this maximum Sharpe ratio, I loop through all possible compositions
from 0%SPY-100%TLT to 100%SPY-0%TLT and calculate the resulting Sharpe ratio for
the look back period.