N:=14;
VA1:=(HIGH+LOW+CLOSE)/3;
VA1I:(VA1-MA(VA1,N))/(0.015*AVEDEV(VA1,N));
rsi1:=VA1I;
VAR1:=REF(RSI1,N)=HHV(RSI1,2*N+1);
VAR2:=BACKSET(VAR1,N+1);
VAR3:=FILTER(VAR2,N) AND RSI1=HHV(RSI1,N+1);
VAR4:=BARSLAST(REF(VAR3,1));
顶背离:REF(CLOSE,VAR4+1)< CLOSE AND REF(RSI1,VAR4+1)>RSI1 AND VAR3,;
DRAWICON(顶背离,VA1I*0.9,2);
DRAWLINE(VAR3,RSI1,FILTER(顶背离>0,5),RSI1,0),COLORGREEN,LINETHICK1;
VAR12:=REF(RSI1,N)=LLV(RSI1,2*N+1);
VAR22:=BACKSET(VAR12,N+1);
VAR32:=FILTER(VAR22,N) AND RSI1=LLV(RSI1,N+1);
VAR5:=BARSLAST(REF(VAR32,1));
底背离:REF(CLOSE,VAR5+1)>CLOSE AND REF(RSI1,VAR5+1)< RSI1 AND VAR32;
DRAWLINE(VAR32,RSI1,FILTER(底背离>0,5),RSI1,0),COLORMAGENTA,LINETHICK1;
DRAWICON(底背离,-130,7);
VA1I底背离:=底背离 AND crOSS(VA1I,-100);
DRAWICON(VA1I底背离,-150,3);
VB1:=CROSS(VA1I,-100);
DRAWICON(VB1,-100,9);
DRAWTEXT(VB1,-90,'买入'),COLORYELLOW;
IF(VA1I>=100,VA1I,DRAWNULL),COLORGREEN;
IF(VA1I<=-100,VA1I,DRAWNULL),COLORRED;