VAR1:=EMA(LLV(LOW,34),3);
VAR2:=EMA(HHV(HIGH,34),3);
VAR3:=EMA((CLOSE-VAR1)/(VAR2-VAR1)*100,3);
VAR4:=SMA(VAR3,8,1);
VAR5:=SMA(VAR4,6,1);
BEILIJ:3*VAR4-2*VAR5,COLORFF00FF,LINETHICK1;
BEILIJ1:MA(BEILIJ,3),COLORYELLOW,LINETHICK1;
VAR6:=BARSLAST(REF(CROSS(BEILIJ,BEILIJ1),1));
VAR7:=REF(CLOSE,VAR6+1)>CLOSE;
VAR8:=VAR7 AND BEILIJ>REF(BEILIJ,VAR6+1);
VAR9:=VAR8 AND CROSS(BEILIJ,BEILIJ1) AND BEILIJ<20;
VAR10:=BARSLAST(REF(CROSS(BEILIJ1,BEILIJ),1));
VAR11:=REF(CLOSE,VAR10+1)<CLOSE;
VAR18:=VAR11 AND REF(BEILIJ1,VAR10+1)>BEILIJ1;
VAR19:=VAR18 AND CROSS(BEILIJ1,BEILIJ) AND BEILIJ>90;
STICKLINE(VAR9,0,25,4,0),COLORFF00FF;
DRAWTEXT(VAR9>0,30,'底背离'),COLORFFFFFF;
DRAWTEXT(VAR19>0,75,'顶背离'),COLORGREEN;
STICKLINE(VAR19,100,80,4,0),COLOR00FF00;
100,COLORGRAY,LINETHICK1;
50,COLORBLUE,LINETHICK1;
0,COLORWHITE,LINETHICK1;