s1:=if(stktype=0 or stktype=7,0.999,0.98);
s2:=if(stktype=0 or stktype=7,1.001,1.02);
ma06:ma(c,6),precision2,color00ffff,linedot;
ma18:ma(c,18),precision2,coloreeeeee,linedot;
partline(ma06>=ref(ma06,1) and cx=1,ma06),color0000cc,linethick2;
partline(ma06<ref(ma06,1) and cx=1,ma06),color009900,linethick2;
partline(ma18>=ref(ma18,1) and cx=2,ma18),color0000cc,linethick2;
v06:ma(vol,6),linethick0,precision0,color6666cc;
v36:ma(vol,36),linethick0,precision0,colorffcc00;
vvol:v,linethick0,precision0,colorff00ff;
a1:=ref(c,n)=hhv(c,2*n+1); b1:=filter(a1,n); c1:=backset(b1,n+1); hd:=filter(c1,n);
a2:=ref(c,n)=llv(c,2*n+1); b2:=filter(a2,n); c2:=backset(b2,n+1); ld:=filter(c2,n);
a:=ref(c,barslast(hd)); b:=ref(c,barslast(ld));
t1:=barslast(hd)<barslast(ld) and not(hd) ;
t2:=barslast(hd)>barslast(ld) and not(ld);
partline(t1,a),colorcc6600,linethick2;
partline(t2,b),colordddddd,linethick2;
drawnumber(t1=0 and ref(t1,1)>0 or islastbar and t1>0,ref(a,1),ref(a,1),2),colorcc6600;
drawnumber(t2=0 and ref(t2,1)>0 or islastbar and t2>0,ref(b,1),ref(b,1),2),colordddddd;
partline(t1,a*0.9),colorcc6600,linethick1;
drawnumber(t1=0 and ref(t1,1)>0 or islastbar and t1>0,ref(a*0.9,1),ref(a*0.9,1),2),colorcc6600;
partline(t2,b*1.1),colordddddd,linethick1;
drawnumber(t2=0 and ref(t2,1)>0 or islastbar and t2>0,ref(b*1.1,1),ref(b*1.1,1),2),colorcdddddd;
drawtext(bza06>=2 and bzb06=1 and v06>v36 and cx=1,ma06*s1,'买入'),color0000cc;
drawtext(bda06>=2 and bdb06=1 and cx=1,ma06*s2,'卖出'),color009900;
drawtext(bza18>=2 and bzb18=1 and v06>v36 and cx=2,ma18*s1,'买入'),color0000cc;
drawtext(bda18>=2 and bdb18=1 and cx=2,ma18*s2,'卖出'),color009900;
tj:=close>open or close=open and close>ref(close,1);
stickline(tj and c>ma18,high,low,0.1,0),colorred;
stickline(tj and c>ma18,close,open,7,0),colorred;
stickline(not(tj) and c>ma18,high,low,0.1,0),colorcyan;
stickline(not(tj) and c>ma18,close,open,7,0),colorcyan;
stickline(tj and c<ma18,high,low,0.1,0),colorred;
stickline(tj and c<ma18,close,open,7,1),colorred;
stickline(not(tj) and c<ma18,high,low,0.1,0),colorcyan;
stickline(not(tj) and c<ma18,close,open,7,1),colorcyan;