%n=1 k=500
win=20; 

for jj=1:length(xxy)-win
    n=jj;
    k=n+win;
 for ii=n:k
    if xxy(1,ii)>0 & xxy(50,ii)>0
        S(ii-n+1)=xxy(1,ii)-xxy(50,ii);
    elseif xxy(1,ii)>0 & xxy(50,ii)<0
        S(ii-n+1)=xxy(1,ii)-abs(xxy(50,ii));
    elseif xxy(1,ii)<0 & xxy(50,ii)<0
        S(ii-n+1)=abs(xxy(1,ii))-abs(xxy(50,ii));
    end   
  end
SS(jj)=mean(S); 
end
for ii=1:length(SS)
    SS1(ii)=SS(ii)*10000;
end
