( @jcl : I know this may not be the right place and that maybe I should have posted a comment on the blog, but as far as I can remember I couldn't post pictures there )

I was trying the EFrontier.c script from the 2016 Repository and this was the result. Look at the X and Y scales.
[Linked Image]

I removed the 4 with negative mean (according to Heatmap.c) thinking it was up to that, and replaced them with SOYB. Based on what is written in the post I would have expected a value just under 11.87, the mean of SPY. Instead, no difference. The scale remained of the same order of magnitude.

At that point I remembered the last comment of the post (evidently valid suggestion, since the change appears in Heatmap.c), and I started messing with the X and Y values of plotBar and plotGraph.
if(is(EXITRUN)) {
int i,j;
for(i=0; i<N; i++) {
Means[i] = Moment(Returns[i],LookBack,1);
for(j=0; j<N; j++)
Covariances[N*i+j] = 252*Covariance(Returns[i],Returns[j],LookBack);
//Covariances[N*i+j] = Covariance(Returns[i],Returns[j],LookBack);
}

var BestV = markowitz(Covariances,Means,N,0);
var MinV = markowitzVariance(0,0);
var MaxV = markowitzVariance(0,1);

PlotScale = 8;
PlotHeight1 = 300;
int Steps = 50;
for(i=0; i<Steps; i++) {
var V = MinV + i*(MaxV-MinV)/Steps;
var R = markowitzReturn(0,V);
plotBar("Frontier",i,V,252*100*R,LINE|LBL2,BLACK);
//plotBar("Frontier",i,V,100*R,LINE|LBL2,BLACK);
}
plotGraph("Max Sharpe",(BestV-MinV)*Steps/(MaxV-MinV),
252*100*markowitzReturn(0,BestV),SQUARE,GREEN);
//100*markowitzReturn(0,BestV),SQUARE,GREEN);
}

[Linked Image]

Now the scales have more plausible values, w/ Frontier = 11.12

I did well?
I'm not deep in math, but it seems that now the "if (is (EXITRUN)) {}" block calculates the daily values, and that multiplying by 252 gives the annual values again. But I don't understand why, can someone explain it to me?
Yet the script is identical to that of the post, apart from PlotScale and PlotHeight1. Has Zorro changed the markowitz * functions over the years?

Last edited by 2cents; 10/29/22 23:27.

Don't poke the bear