N:=27;
VAR1:=4*SMA((CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100,6,1)-
3*SMA(SMA((CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100,4,1),3.2,1),COLORYELLOW,LINETHICK1;
增强: IF(CROSS(VAR1,8),2,0),STICK,LINETHICK2;
RSV:=(((C-LLV(L,9))/(HHV(H,9)-LLV(L,9)))*100);
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
KDJ:=((3*K)-(2*D));
LC:=REF(C,1);
RSI:=((SMA(MAX((C-LC),0),6,1)/SMA(ABS((C-LC)),6,1))*100);
W:=((100*(HHV(H,14)-C))/(HHV(H,14)-LLV(L,14)));
M1:=((HHV(H,50)/LLV(L,100))>1.5);
M2:=((HHV(H,50)-L)/(HHV(H,50)-LLV(L,100)));
M3:=((L-LLV(L,100))/(HHV(H,50)-LLV(L,100)));
M4:=(HHVBARS(H,50)<LLVBARS(L,100));
M5:=(((M1&&(M2>0.5))&&(M3>0.3))&&M4);
M6:=(COUNT(M5,10)=1);
买入:IF(((KDJ<0)&&(RSI<20)),3,0),COLORMAGENTA;
MACD:=(MACD.DIF-MACD.DEA)*2;
A1:=BARSLAST(REF(CROSS(MACD.DIF,MACD.DEA),1));
A2:=BARSLAST(REF(CROSS(MACD.DEA,MACD.DIF),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND MACD.DIF> REF(MACD.DIF,A1+1) AND CROSS(MACD.DIF,MACD.DEA);
顶背离:=REF(CLOSE,A2+1)< CLOSE AND REF(MACD.DIF,A2+1)>MACD.DIF AND CROSS(MACD.DEA,MACD.DIF);
①:IF(REF((MA(C,5)-C)/C>0.04 AND (MA(C,10)-MA(C,5)) /MA(C,5)>0.04 AND C> REF(C,1),1),44,0),LINETHICK3,COLORCYAN;
④:IF(底背离,57,0),LINETHICK3,COLORBROWN;
DRAWTEXT(底背离,54,'←MACD 底背离'),COLORWHITE;