Hi, I have experimented the scripts posted in the Financial Hacker blog, and I found unexpected behaviors.
The Markowitz script most of the time does not provide better results than 1/N allocation strategy. This is an example. The ETFs:
"XMUS.MI", // db x-trackers MSCI USA Index UCITS ETF 1C EUR LU0274210672 CAP "XEMB.MI", // db x-trackers II Emerging Markets Liquid Eurobond UCITS ETF 1C EUR LU0321462953 CAP "XGIN.MI", // db x-trackers II iBoxx Global Inflation-Linked UCITS ETF 1C EUR LU0290357929 CAP "EMG.MI", // Lyxor Ucits Etf Eumts Infl Linked Inv Gr FR0010174292 CAP "EMI.MI", // Lyxor UCITS ETF EuroMTS Inflation Linked Investment Grade (DR) (EUR) FR0010174292 CAP "XFFE.MI", // db x-trackers II Fed Funds Effective Rate UCITS EUR LU0321465469 CAP
(just copy and paste this set in the original scripts)
provide a good HeatMap, but not a good MVOtest. I can not say why. I have tried several set of ETFs and, most of the times, the MVO was not as good than 1/N allocation strategy.
I have seen that results vary a lot based on the data quality of the ETFs chosen and the mix of mean/Variance more than based on quality of the "heatmap".
The first point of attention was the quality of data. Be aware that Yahoo sometimes download less data than expected. Yahoo ETF graph goes back to 2008 while you download only 2 years for testing. (some sort of filter/check could help)
The second point of attention was ETF with profit periodic distribution. It seems that they works not as good than ETFs with capitalized profits, but I can not mathematically prove my impressions
Heatmap and MVOTest of previous ETF Sample attached.
I am very interested in improving ETFs allocation strategy, and I was very disappointed that MVO did not perform as expected. I am looking forward to someone else experience and feedback.
Ciao
Re: The unfashionable Markowitz
[Re: MatPed]
#459412 05/16/1611:2705/16/1611:27
Yes, it depends on the components. You normally use more components, such as 20 or 30. Here's a modified script that reads a selection of the most popular ETFs from an asset list in the Strategy folder (both attached).
Your result is also relatively untypical. The typical result that I get with most portfolios is either a much higher profit with the red max return line, or a lower profit but a much better Sharpe ratio with the blue minimum variance line. You can see that with the attached system. For live trading you would normally use the minimum variance version, even though the absolute return is smaller than 1/N. Do many experiments with other ETFs!
Re: The unfashionable Markowitz
[Re: jcl]
#459414 05/16/1612:2205/16/1612:22
It does not make a difference for the portfolio weights, since the historical prices include the dividends. It could make a difference for the tax declaration, since AFAIK dividends are treated differently than profits in some countries. If dividends are distributed, reinvest them.
Re: The unfashionable Markowitz
[Re: jcl]
#459422 05/17/1615:4305/17/1615:43
I'm interested in this topic and jad some communication with jcl on Financial Hacker, I use ZorroS and my broker is IB, I want to test MVO and get all the metrics just like Z8. I'm new to programming, barely managed some codes like follwoing:
function run() { set(PARAMETERS); BarPeriod = 1440; LookBack = 252 ; NumYears = 7; Verbose = 0; set(PRELOAD); // allow extremely long lookback period NumWFOCycles = 5; MonteCarlo = 1000; Capital = 100000;//intent to calculate CARG
assetList("AssetsETF.csv");
string Names[NN]; vars Returns[NN]; var Means[NN]; var Covariances[NN][NN]; var Weights[NN];
int OldLots[NN] ;//positions
var Allmystake = 100000 ;//equals to Capital var VFactor = 10; int i,j; static var BestVariance = 0; static var MinVariance = 0; static int Month = 0;
//Get Assets History and calculate returns int N = 0; while(Names[N] = loop((Assets))) { if(is(INITRUN)) assetHistory(Names[N],FROM_YAHOO); asset(Names[N]); Returns[N] = series((priceClose(0)-priceClose(1))/priceClose(1)); if(N++ >= NN) break; }
Unfortunately something went so wrong, Allmystake has always been 0 and no positions have been reported.I guess I didn't calculate Allmystake properly, which is the total equity I can invest.