Monday, September 6, 2010

Sell in May and go away

S&P return cycle monthly


While this is an over-simplification, the same approach can be used for different periods that match with analysis need e.g. holiday return


Data downloaded from Yahoo! Finance


This was computed using Ox code:


main()
{

ranseed(967537412);

decl m,i,j,averageReturn,file;

m = new matrix[OBSERVATIONS][2];
m = loadmat(FILENAME);
averageReturn = new matrix[12][2];

for (i = 0 ; i < 12 ; ) averageReturn[i][0] = i++;

for (i = 0 ; i < OBSERVATIONS ; i++)
{
for (j = 0 ; j < 12 ; j++)
{
if (m[i][0] == j+1) averageReturn[j][1] += m[i][1];
}
}

for (i = 0 ; i < 12 ; i++) averageReturn[i][1] /= 252/12;

file = fopen("monthOutput.csv","w");
for (i = 0 ; i < 12 ; i++)
{
fprint(file, averageReturn[i][0]+1, ",");
fprint(file, averageReturn[i][1], "\n");
}
fclose(file);
}



Xem đầy đủ bài viết tại http://feedproxy.google.com/~r/TaiTran/~3/dJfKYTiVkYs/sell-in-may-and-go-away.html

No comments:

Post a Comment

Popular Posts