Why do I have different result through ans key?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to compute maximum drawdowns within a vector, but the for loop gives me wrong results. Basically I have a vector called portfolio with cumulative returns and another vector called rows_cycle that gives me the rows for which i should compute the maxdrawdown. The code is:
letstry = zeros(length(rows_cycle)-1,1);
for i = 2:1:length(rows_cycle)
letstry(i-1,1) = maxdrawdown(portfolio(rows_cycle(i-1:i)));
end
the problem is that if I put maxdrawdown(portfolio(233:358)), it gives me a different result from maxdrawdown(portfolio(rows_cycle(3-1:3))), when rows_cycle(2:3) = 233:358
Even if I compute first rows_cycle(2:3) and then maxdrawdown(portfolio(ans)), the results are different from maxdrawdown(portfolio(233:358)).
What's wrong with the loop? thx
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Fractals dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!