/*[[ Name := MACDMYSIG(3bars) Author := Dima Link := http://www.viac.ru/ Separate Window := No First Color := Blue First Draw Type := Symbol First Symbol := 202 Use Second Data := Yes Second Color := Red Second Draw Type := Symbol Second Symbol := 200 ]]*/ Variable : shift(0),MACDH(0),MACDL(0),priceh(0),pricel(0),k(0),count(0),z(0); SetLoopCount(0); // loop from first bar to current bar (with shift=0) For shift=1 to 300 Begin //поиск дивера на продажу if iMACD(5,34,5,mode_main,shift)>0 and iMACD(5,34,5,mode_main,shift+1)>0 and iMACD(5,34,5,mode_main,shift+2)>0 and iMACD(5,34,5,mode_main,shift)iMACD(5,34,5,mode_main,shift+2) then Begin MACDH=iMACD(5,34,5,mode_main,shift+1); priceh=Close[shift+1]; if priceh0 and iMACD(5,34,5,mode_main,count+1)>0 and iMACD(5,34,5,mode_main,count+2)>0 and iMACD(5,34,5,mode_main,count)iMACD(5,34,5,mode_main,count+2) and MACDH=Close[count+1] and priceh>=Close[count+2] and priceh>=Close[count+3] and z<=iMACD(5,34,5,mode_main,count+1) then SetIndexValue(shift,priceh+0.0030); if ziMACD(5,34,5,mode_main,shift+1) and iMACD(5,34,5,mode_main,shift+1)close[shift+2] then pricel=close [shift+2]; if pricel>close[shift+3] then pricel=close [shift+3]; k=shift;z=0; For count=k+2 to k+60 Begin if iMACD(5,34,5,mode_main,count)<0 and iMACD(5,34,5,mode_main,count+1)<0 and iMACD(5,34,5,mode_main,count+2)<0 and iMACD(5,34,5,mode_main,count)>iMACD(5,34,5,mode_main,count+1) and iMACD(5,34,5,mode_main,count+1)iMACD(5,34,5,mode_main,count+1) and pricel<=Close[count+1] and pricel<=Close[count+2]and pricel<=Close[count+3] and z>=iMACD(5,34,5,mode_main,count+1) then SetIndexValue2(shift,pricel-0.0030); if z>iMACD(5,34,5,mode_main,count) then z=iMACD(5,34,5,mode_main,count); end; end; End;