N:=5;
MA1:MA(CLOSE,5);
MA2:MA(CLOSE,10);
MA3:MA(CLOSE,20);
MA4:MA(CLOSE,30);
MA5:MA(CLOSE,60);
MA6:MA(CLOSE,120);
MA7:MA(CLOSE,250);
D1:=REF(H,N);
D2:=D1=HHV(H,2*N+1);
D3:=FILTER(D2,N);
D4:=BacKSET(D3,N+1);
HD:=FILTER(D4,N);
D5:=REF(L,N);
D6:=D5=LLV(L,2*N+1);
D7:=FILTER(D6,N);
D8:=BACKSET(D7,N+1);
LD:=FILTER(D8,N);
D:=BACKSET(ISLASTBAR,BArslAST(HD)+1);
E:=D>REF(D,1);
F:=BACKSET(E,REF(BARSLAST(HD),1)+2);
G:=F>REF(F,1);
DRAWLINE(G,H,E,H,1),POINTDOT,LINETHICK1,coloryellow;
I:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
J:=I>REF(I,1);
K:=BACKSET(J,REF(BARSLAST(LD),1)+2);
M:=K>REF(K,1);
DRAWLINE(M,L,J,L,1),POINTDOT,LINETHICK1,COLORFFB97A;
M1:=BARSLAST(E);
M2:=BARSLAST(G);
M3:=REF(H,M1);
M4:=REF(H,M2);
M5:=M4-M2*(M4-M3)/(M2-M1);
DRAWICON(REF(C,1)<=REF(M5,1) AND C>M5,M5,4);
N1:=BARSLAST(J);
N2:=BARSLAST(M);
N3:=REF(L,N1);
N4:=REF(L,N2);
N5:=N4-N2*(N4-N3)/(N2-N1);
//{ _同花顺指标公式}
DRAWICON(REF(C,1)>=REF(N5,1) AND C<N5,N5,5);
买点:IF(REF(C,1)<=REF(M5,1) AND C>M5,1,0), LINETHICK0 ;
卖点:IF(REF(C,1)>=REF(N5,1) AND C<N5,1,0), LINETHICK0 ;
DRAWTEXT(TROUGHBARS(3,15,1)<4,LOW*0.95,'底') , colorred,LINETHICK1;
DRAWTEXT(crOSS(REF(zig(3,10),1),ZIG(3,10)),HIGH*1.004,'顶') , colorgreen,LINETHICK1;
DRAWICON(CROSS(ZIG(3,10) ,REF(ZIG(3 ,10),1)) ,LOW*0.85,'buy');