RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;//收盘价与N周期最低值做差,N周期最高值与N周期最低值做差,两差之间做比值定义为RSV
K:=SMA(RSV,3,1);//RSV的移动平均
D:=SMA(K,3,1);//K值的移动平均
DIFF := EMA(CLOSE,12) - EMA(CLOSE,26);
DEA :=EMA(DIFF,9);
MID:=MA(CLOSE,26);
TMP2:=STD(CLOSE,26);
TOP:=MID+2*TMP2;
BOTTOM:=MID-2*TMP2;
D1:=DIFF>DEA&&K>D&&BARSLAST(EVERY(ISUP,2))<=2;
K1:=DIFF<DEA&&K<D&&BARSLAST(EVERY(ISDOWN,2))<=2;
Q0:=H-MAX(C,O)>MIN(C,O)-L||MIN(C,O)-L<H-MAX(C,O)+3*MINPRICE||MAX(C,O)=H||MIN(C,O)=L;
Q1:=REF(C>=O,2)&&EVERY(ISDOWN&&Q0,2)&&H-L<REF(H-L,1)+10*MINPRICE&&IF(REF(SUM((MAX(C,O)=H||MIN(C,O)=L)&&ISUP,2)>0,2),MAX(C,O)=H||MIN(C,O)=L||REF(MAX(C,O)=H||MIN(C,O)=L,1),1);
Q2:=REF(H,1)=HHV(H,4)||REF(H,2)=HHV(H,4)||REF(ISDOWN,1)&&REF(ISDOWN,3)&&REF(H,3)=HHV(H,4);
Q3:=REF(H-L,1)>=REF(HV(H-L,2),1)||REF(ISDOWN,1)&&REF(ISDOWN,3)&&REF(H-L,1)>=REF(H-L,2);
Q4:=C<=LV(L,3);
Q5:=REF(C<=REF(L,1)&&IF(H>REF(H,1), O>=REF(C,1),1),1);
QQ:=Q1&&Q2&&Q3&&Q4&&Q5&&REF(NOT(ISEQUAL),2)&&NOT(NOT(H=MAX(C,O)||L=MIN(C,O))&&REF(H=MAX(C,O)||L=MIN(C,O),2)&&REF(H=MAX(C,O)||L=MIN(C,O),3));
REF(CROSS(DIFF<DEA&&K<D&&EXIST(QQ,3),0.5),1),NOTICE('空');
DRAWICON(CROSS(DIFF<DEA&&K<D&&EXIST(QQ,3),0.5),H,2);
W0:=H-MAX(C,O)<MIN(C,O)-L||MIN(C,O)-L+3*MINPRICE>H-MAX(C,O)||MAX(C,O)=H||MIN(C,O)=L;
W1:=REF(C<=O,2)&&EVERY(ISUP&&W0,2)&&H-L<REF(H-L,1)+10*MINPRICE&&IF(REF(SUM((MAX(C,O)=H||MIN(C,O)=L)&&ISDOWN,2)>0,2),MAX(C,O)=H||MIN(C,O)=L||REF(MAX(C,O)=H||MIN(C,O)=L,1),1);
W2:=REF(L,1)=LLV(L,4)||REF(L,2)=LLV(L,4)||REF(ISUP,1)&&REF(ISUP,3)&&REF(L,3)=LLV(L,4);
W3:=REF(H-L,1)>=REF(HV(H-L,2),1)||REF(ISUP,1)&&REF(ISUP,3)&&REF(H-L,1)>=REF(H-L,2);
W4:=C>=HV(H,3);
W5:=REF(C>=REF(H,1)&&IF(L<REF(L,1), O<=REF(C,1),1),1);
WW:=W1&&W2&&W3&&W4&&W5&&REF(NOT(ISEQUAL),2)&&NOT(NOT(H=MAX(C,O)||L=MIN(C,O))&&REF(H=MAX(C,O)||L=MIN(C,O),2)&&REF(H=MAX(C,O)||L=MIN(C,O),3));
REF(CROSS(DIFF>DEA&&K>D&&EXIST(WW,3),0.4),1),NOTICE('多');
DRAWICON(CROSS(DIFF>DEA&&K>D&&EXIST(WW,3),0.4),H,1);
DRAWKLINE1(H,O,L,C);