{主力筹码 2}
CVAR8:=((C-LLV(L,21))/(HHV(H,21)-LLV(L,21)))*100;
CVAR9:=SMA(CVAR8,13,8);
风险:CEILING(SMA(CVAR9,13,8)),LINETHICK3,COLORRED;
涨跌:=MA(3*SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))*100,5,1)-2*SMA(SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))*100,5,1),3,1),5),LINETHICK3,COLORYELLOW;
DRAWTEXT(crOSS(风险,涨跌) && 风险<20,风险,'预'),COLORYELLOW;
DRAWICON(风险 >= REF(风险,1) && REF(风险,2) > REF(风险,1),风险,1);
DRAWICON(风险 <= REF(风险,1) && REF(风险,1) > REF(风险,2),风险,2);
{skdj}
SkdjN:=9;SkdJM:=3;
SKDJ_LOWV:=LLV(LOW,SKDJN);
SKDJ_HIGHV:=HHV(HIGH,SKDJN);
SKDJ_RSV:=EMA((CLOSE-SKDJ_LOWV)/(SKDJ_HIGHV-SKDJ_LOWV)*100,SKDJM);
K0:EMA(SKDJ_RSV,SKDJM),COLORWHITE;
D0:MA(K0,SKDJM),COLORYELLOW;
乖离率:K0/D0;
DRAWICON(CROSS(D0,K0),(D0+K0)/2,37);
DRAWICON(CROSS(K0,D0),(D0+K0)/2,1);
{背离}
A1:=BArslAST(REF(CROSS(K0,D0),1));
底背离:REF(CLOSE,A1+1)>CLOSE AND K0>REF(K0,A1+1) AND CROSS(K0,D0);
DRAWLINE(A1=0,D0,底背离,D0,0),COLORRED,DOTLINE;
A2:=BARSLAST(REF(CROSS(D0,K0),1));
顶背离:REF(CLOSE,A2+1)
DRAWLINE(A2=0,D0,顶背离,D0,0),COLORGREEN,DOTLINE;
DRAWTEXT(底背离>0,D0-5,'底背离'),COLORRED;
DRAWTEXT(顶背离>0,D0-5,'顶背离'),COLORGREEN;
K60:=K0#MIN60;
D60:=D0#MIN60;
XG:IF((CROSS(K60,D60)) || (K60>REF(K60,1)>REF(K60,2) && K60/D60 <=1) || (K60>REF(K60,1) && REF(K60,1)<=REF(K60,2)) ,15,0),COLORRED;
DBA:IF((CROSS(D60,K60)) || (K60>REF(K60,1)>REF(K60,2) && K60/D60 >=1) || (K60=REF(K60,2)) ,90,100),COLORYELLOW;
Dbs:IF((风险 <= REF(风险,1) && REF(风险,1) > REF(风险,2)) || 风险>95,85,100),COLORGREEN;
预警:IF(
(K0/D0 > REF(K0,1)/REF(D0,1))
,10,0),COLORYELLOW;
{
(K0>=REF(K0,1) || K0 < REF(K0,1)) &&
REF(K0,1) < REF(K0,2)
};
{(K0/D0 < REF(K0,1)/REF(D0,1)) || (K0/D0 > REF(K0,1)/REF(D0,1) && REF(K0,1)/REF(D0,1) > REF(K0,2)/REF(D0,2)) || (CROSS(K0,D0) && REF(K0,1)/REF(D0,1) > REF(K0,2)/REF(D0,2))};