/*[[ Name := Silver sen Author := Copyright © 2003, VIAC.RU AlexSilver Link := http://viac.ru/ Separate Window := No First Color := SlateBlue First Draw Type := Symbol First Symbol := 130 Use Second Data := No ]]*/ Inputs : CCIP(14), limit(80), delta(15), KBars(500); // limit - границы в которых находится зигзаг // delta - расстояние между "хвостами" и "серединой" Variables : shift(0), cnt(0), sh(0), loopbegin(0), firstTime(True); Variables : val(0),cciU(0),cciD(0); Array: tt[20](0); SetLoopCount(0); If firstTime Then { if KBars==0 then { loopbegin = Bars-1; } else { loopbegin = KBars-1; } }; For shift = loopbegin Downto 0 Begin val=0; cciU=0; cciD=0; For sh = 0 to 19 { // Заполнение массива точек. tt[sh]=iCCIEx(CCIP,PRICE_TYPICAL,shift+sh); // Определение наличия тренда. if sh<=8 then { if tt[sh]>=0 then { cciU++; } else { cciD++; } } } // шаму в нисходящем тренде if cciD >=6 and tt[0]>tt[1]+delta and tt[1]tt[3] and tt[1]<=limit and tt[1]>=-limit and tt[2]<=limit and tt[2]>=-limit then { val=L[shift]-4*Point; //val=-1; } // шаму в восходящем тренде if cciU >=6 and tt[0]tt[2] and tt[2]-0=-limit and tt[1]<=limit and tt[2]>=-limit and tt[2]<=limit then { val=H[shift]+4*Point; //val=1; } SetIndexValue(shift,val); loopbegin = loopbegin-1; End;