function [cci]=CCI(close,high,low,longueur)

if size(close,2)>size(close,1)
    close=close';
end;
if size(high,2)>size(high,1)
    high=high';
end;
if size(low,2)>size(low,1)
    low=low';
end;

typical_price=(close+high+low)/3.0;
moy=MM(typical_price,longueur);

dev=zeros(size(close,1),1);
cci=zeros(size(close,1),1);
for i=longueur:size(close,1)
    dev(i)=sum(abs(typical_price(i-longueur+1:i)-moy(i)))/longueur;
    cci(i)=(typical_price(i)-moy(i))/(0.015*dev(i));
end;


