There is nothing wrong with for loops in julia. I think sturm would be prettier if you removed `n=length(D)` and instead used `t=zeros(D)` and `for i=2:length(D)`. Julia creates a Range object for iteration, so the length function will only execute once.
countnegatives+=1 Do you really need an array for t? It seems to me like you only use the previous element and could do well with a scalar variable.
