Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
function dailyReturn = dailyReturns ( closingPrices )
    n = size(closingPrices , 2);
    dailyReturn = zeros(n1, 1n);
    for i = 2:n
        dailyReturn(i)= closingPrices(i)-closingPrices(i-1);
    end
end

...

Code Block
 function res = isGoingUp ( ndailyReturn, i, dailyReturn n)
    res = true ;
    for jstart = i: -1:min(length(dailyReturn),i);
    stop = max (1, i-n +1);
    for j = start : -1: stop
        if ( dailyReturn (j) < 0)
            res = false ;
            return ;
        end
    end
end

...