DIFF:EMA(CLOSE,10)-EMA(CLOSE,21);
DEA:EMA(DIFF,8);
MACD:2*(DIFF-DEA), COLORSTICK,LINETHICK2;
强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED,LINETHICK1;
弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA,LINETHICK1;
DD0:=C=HHV(C,180);
EE:=DEA< REF(DEA,1) AND REF(DEA< REF(DEA,1),1)=1;
CC:=C> REF(C,1) AND REF(C> REF(C,1),1)=1;
上升背离:(CC AND EE)*DEA,COLORLIBLUE;
FF:=C=LLV(C,180);
GG:= DEA> REF(DEA,1) AND REF(DEA> REF(DEA,1),1)=1;
LL:=C< REF(C,1) AND REF(C< REF(C,1),1)=1;
下降背离:(LL AND GG)*DEA,COLORFF937F;
RSV0:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
KK:=SMA(RSV0,3,1);
DD:=SMA(KK,3,1);
A22:=BARSLAST(REF(CROSS(KK,DD),1));
B2:=REF(C,A22+1)>C AND REF(KK,A22+1)<KK AND CROSS(KK,DD);
DRAWTEXT(IF(B2>0,1,0),0-0.01,'K底'),COLORYELLOW;
C2:=BARSLAST(REF(CROSS(DD,KK),1));
DD2:=REF(C,C2+1)<C AND REF(KK,C2+1)>KK AND CROSS(DD,KK);
DRAWTEXT(IF(DD2>0,1,0),0+0.01,'K顶'),COLORYELLOW;
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(C,A3+1)>C AND REF(RSI1,A3+1)<RSI1 AND CROSS(RSI1,RSI2);
DRAWTEXT(IF(B3>0,1,0),0-0.01,'R底'),COLORFF00FF;
C3:=BARSLAST(REF(CROSS(RSI2,RSI1),1));
D3:=REF(C,C3+1)<C AND REF(RSI1,C3+1)>RSI1 AND CROSS(RSI2,RSI1);
DRAWTEXT(IF(D3>0,1,0),0+0.01,'R顶'),COLORFF00FF;