N:=5;
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);
A11:=BACKSET(ISLASTBAR,TROUGHBARS(2,N,1)+1);
A21:=A11>REF(A11,1);
B11:=BACKSET(ISLASTBAR,TROUGHBARS(2,N,2)+1);
B21:=B11>REF(B11,1);
C11:=BACKSET(ISLASTBAR,TROUGHBARS(2,N,3)+1);
C21:=C11>REF(C11,1);
①:DRAWLINE(B2,H,A2,H,0),COLORBLUE;
②:DRAWLINE(C2,H,B2,H,0),COLORCC6633;
③:IF(A1,PEAK(1,N,1),DRAWNULL),COLORFFAA00;
④:DRAWLINE(C2,H,A2,H,0),COLORLIBLUE;
⑤:DRAWLINE(B21,L,A21,L,0),COLORYELLOW;
⑥:DRAWLINE(C21,L,B21,L,0),COLORFF00FF;
⑦:DRAWLINE(C21,L,A21,L,0),COLORBROWN;
⑧:IF(A11,TROUGH(2,N,1),DRAWNULL),COLORRED;
三角形主图(通达信)的选股公式如下: