ZQ:=DATacOUNT-BARPOS;
QWX1:=HHV(CLOSE,30);
QWX2:=LLV(CLOSE,30);
QWX3:=REFX((QWX1+QWX2)/2,ZQ);
{macd}
DIF:=(EMA(CLOSE,12)-EMA(CLOSE,26))*2+QWX3,COLORWHITE;
DEA:=EMA(DIF,9),COLORYELLOW;
MCD:=(DIF-DEA)*2+QWX3;
FILLRGN(MCD>QWX3,MCD,QWX3),Color640078;
FILLRGN(MCD<QWX3,MCD,QWX3),Color32643C;
A001:=CLOSE-REF(CLOSE,6);
A002:=MA(A001,6);
A003:=((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9)))*100;
A004:=SMA(A003,3,1);
A005:=SMA(A004,3,1);
A006:=EMA((3*A004-2*A005),2);
A007:=(HIGH+LOW+CLOSE)/3;
A008:=((A007-MA(A007,14))/(0.015*AVEDEV(A007,14)))/2;
A009:=(A008+(EMA(((0-(100*(HHV(HIGH,14)-CLOSE)/(HHV(HIGH,14)-LLV(LOW,14))))+100)/100,3)*200-100))/2;
A010:=A009-REF(A009,14);
A011:=A009-REF(A009,26);
A012:=(A009+A010+A011)/3;
KKM:=EMA(A012,4);
A013:=HHV(HIGH,34);
A014:=(2*CLOSE+HIGH+LOW)/4;
A015:=LLV(LOW,34);
A016:=EMA(((A014-A015)/(A013-A015))*100,13);
A017:=EMA(0.667*REF(A016,1)+0.333*A016,2);
KKMD:=A016-A017>1 AND A016<30 AND A017<30;
KKML:=A016-A017<0 AND A016>80 AND A017>80 AND REF(A016-A017,1)>0;
KKMQ:=COUNT(A016-A017>0,2)=2;
KKAL:=(A016-A017)<0;
生命线:MA(CLOSE,20),LINETHICK2,COLOR0000FF;
取舍线:MA(CLOSE,10),LINETHICK2;
STICKLINE(CLOSE>OPEN,OPEN,LOW,0.5,0 ),COLOR0000FF;
STICKLINE(CLOSE>OPEN,CLOSE,HIGH,0.5 ,0 ),COLOR0000FF;
STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE,OPEN,HIGH,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLORff7700;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLORff9900;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLORffbb00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLORffcc00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLORffdd00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLORffee00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1,0 ),COLORffFF00;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,7,0) ,COLOR000055;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLOR000066;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,5,0) ,COLOR000077;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLOR000099;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLOR0000bb;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLOR0000dd;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,1,0) ,COLOR0000ff;
{ _最新股票指标公式}
var9Q:=c= hhv(c,4)and (ref(c,1)>=ref(c,2) or ref(c,1)>=ref(c,3)) or ref(c,1)=hhv(c,4) and close>=ref(c,2) or ref(c,2)=hhv(c,4) and ref(c,3)=llv(c,4) and c>=ref(c,1) or ref(c,3)=hhv(c,4) and c>=ref(c,1) and c>=ref(c,2);
varaQ:=c=hhv(c,4) and ref(c,1)=llv(c,4);
varbQ:=c=llv(c,4) and (ref(c,1)<ref(c,2) or ref(c,1)<ref(c,3)) or ref(c,1)=llv(c,4) and c<ref(c,2) or ref(c,2)=llv(c,4) and ref(c,1)<>hhv(c,4) and c<ref(c,1) or ref(c,3)=llv(c,4) and c<ref(c,1) and c<ref(c,2);
varcQ:=ref(c,1)=llv(c,4) and c>=ref(c,2) or ref(c,2)=llv(c,4) and ref(c,1)<=ref(c,3) and ref(c,2)<ref(c,4) and c>=ref(c,1);
vardQ:=ref(c,1)=hhv(c,4) and c<ref(c,2) or (ref(c,2)=hhv(c,4) and ref(c,1)>ref(c,3) or ref(c,3)=hhv(c,4) and ref(c,1)>ref(c,2)) and ref(c,2)>=ref(c,4) and c<ref(c,1);
红:=var9Q;
stickline(var9Q,c,(o+c)/2,7,0),color000055;
stickline(var9Q,c,(o+c)/2,6,0),color000066;
stickline(var9Q,c,(o+c)/2,5,0),color000077;
stickline(var9Q,c,(o+c)/2,4,0),color000099;
stickline(var9Q,c,(o+c)/2,3,0),color0000bb;
stickline(var9Q,c,(o+c)/2,2,0),color0000dd;
stickline(var9Q,c,(o+c)/2,1,0),color0000ff;
粉:=varaQ;
stickline(varaQ,c,(o+c)/2,7,0),colorff11ff;
stickline(varaQ,c,(o+c)/2,6,0),colorff33ff;
stickline(varaQ,c,(o+c)/2,5,0),colorff55ff;
stickline(varaQ,c,(o+c)/2,4,0),colorff77ff;
stickline(varaQ,c,(o+c)/2,3,0),colorff99ff;
stickline(varaQ,c,(o+c)/2,2,0),colorffbbff;
stickline(varaQ,c,(o+c)/2,1,0),colorffddff;
灰:=varbQ;
stickline(varbQ,c,(o+c)/2,7,0),color333333;
stickline(varbQ,c,(o+c)/2,6,0),color555555;
stickline(varbQ,c,(o+c)/2,5,0),color777777;
stickline(varbQ,c,(o+c)/2,4,0),color999999;
stickline(varbQ,c,(o+c)/2,3,0),colorbbbbbb;
stickline(varbQ,c,(o+c)/2,2,0),colordddddd;
stickline(varbQ,c,(o+c)/2,1,0),colorffffff;
绿:=varcQ;
stickline(varcQ,o,(o+c)/2,7,0),color003300;
stickline(varcQ,o,(o+c)/2,6,0),color005500;
stickline(varcQ,o,(o+c)/2,5,0),color007700;
stickline(varcQ,o,(o+c)/2,4,0),color009900;
stickline(varcQ,o,(o+c)/2,3,0),color00bb00;
stickline(varcQ,o,(o+c)/2,2,0),color00dd00;
stickline(varcQ,o,(o+c)/2,1,0),color00ff00;
蓝:=vardQ;
stickline(vardQ,o,(o+c)/2,7,0),colorff1100;
stickline(vardQ,o,(o+c)/2,6,0),colorff3300;
stickline(vardQ,o,(o+c)/2,5,0),colorff5500;
stickline(vardQ,o,(o+c)/2,4,0),colorff7700;
stickline(vardQ,o,(o+c)/2,3,0),colorff9900;
stickline(vardQ,o,(o+c)/2,2,0),colorffbb00;
stickline(vardQ,o,(o+c)/2,1,0),colorffdd00;
DRAWTEXT(FILTER(KKMD,30),L-0.1,'最佳买入时机'),COLOR00FFFF;
DRAWTEXT(FILTER(KKML,30),H+0.1,'最佳卖出时机'),COLORFFFF00;
DRAWTEXT(FILTER(KKMQ,30),C,'持仓区'),COLOR00FF00;
DRAWTEXT(FILTER(KKAL,30),H+0.1,'空仓区'),COLORFF8080;
DRAWTEXT(FILTER(CLOSE/REF(CLOSE,1)>INDEXC/REF(INDEXC,1),30),L-0.3,'该股强于大盘'),COLORFF00FF;
DRAWTEXT(crOSS(MA(CLOSE,5),MA(CLOSE,10)),L-0.5,'可出手'),COLORFF00FF;
DRAWTEXT(CROSS(MA(CLOSE,10),MA(CLOSE,5)),H+0.5,'收手了'),COLORFF0000;
DRAWTEXT(FILTER(KKM>EMA(KKM,4) AND KKM>REF(KKM,1),30),L-0.3,'快速介入');
DRAWTEXT(FILTER(KKM<EMA(KKM,4) AND KKM<REF(KKM,1),30),H+0.3,'风险较大');
DRAWTEXT(FILTER(KKM>EMA(KKM,4) AND KKM<REF(KKM,1),30),H+0.1,'休息观望~'),COLORAA8800;
DRAWTEXT(FILTER(KKM<EMA(KKM,4) AND KKM>REF(KKM,1),30),L-0.1,'有防御能力')
,COLORAA00AA;