N:=3;
ZIG(1,N);
A1:=BACKSET(ISLASTBAR,PEAKBARS(1,N,1)+1);
A2:=A1>REF(A1,1);
B1:=BACKSET(ISLASTBAR,PEAKBARS(1,N,2)+1);
B2:=B1>REF(B1,1);
C1:=BACKSET(ISLASTBAR,PEAKBARS(1,N,3)+1);
C2:=C1>REF(C1,1);
D1:=BACKSET(ISLASTBAR,PEAKBARS(1,N,4)+1);
D2:=D1>REF(D1,1);
E1:=BACKSET(ISLASTBAR,PEAKBARS(1,N,5)+1);
E2:=E1>REF(E1,1);
DRAWLINE(B2,H,A2,H,1),COLORRED;
DRAWLINE(C2,H,B2,H,1),COLORYELLOW;
AA1:=BACKSET(ISLASTBAR,TROUGHBARS(1,N,1)+1);
AA2:=AA1>REF(AA1,1);
BB1:=BACKSET(ISLASTBAR,TROUGHBARS(1,N,2)+1);
BB2:=BB1>REF(BB1,1);
CC1:=BACKSET(ISLASTBAR,TROUGHBARS(1,N,3)+1);
CC2:=CC1>REF(CC1,1);
DD1:=BACKSET(ISLASTBAR,TROUGHBARS(1,N,4)+1);
DD2:=DD1>REF(DD1,1);
EE1:=BACKSET(ISLASTBAR,TROUGHBARS(1,N,5)+1);
EE2:=EE1>REF(EE1,1);
DRAWLINE(BB2,L,AA2,L,1),COLORGREEN;
DRAWLINE(CC2,L,BB2,L,1),COLORBLUE;
DDH:=PEAKBARS(1,N,1)-PEAKBARS(1,N,2);
DDL:=TROUGHBARS(1,N,2)-TROUGHBARS(1,N,1);
YYH:=PEAK(1,N,1)-PEAK(1,N,2);
YYHP:=YYH/PEAK(1,N,2)+1;
YYL:=TROUGH(1,N,1)-TROUGH(1,N,2);
YYLP:=YYL/TROUGH(1,N,2)+1;
DRAWLINE(BB2,L,(BB2+DDH),(TROUGH(1,N,2)*YYHP),1),LINETHICK2,COLORCYAN;
DRAWLINE(B2,H,(B2+DDL),(PEAK(1,N,2)*YYLP),1),LINETHICK2,COLORLIMAGENTA;