江恩箱画线:
drawtext(sysparam(2)=barpos,c,'板块:'+blkname),colorccffff,align4;
dd:="xh-z.dd"(n);
gg:="xh-z.gg"(n);
z:=dd*L+gg*h;
gd:=gg+dd;
p:=SYSPARAM(1);
sgd:=sum(gd,0);
gds:=sgd[p]-sgd+1;
sb:=if(gds<1,1,gds);
sa:=(sb<ref(sb,1))*sb;
hb:=hhv((sa=1)*BARPOS,0);
q:=hb[p];
wgd:=ref(barslast(gd),1)+1;
DRAWICON(gd,gg*h+dd*L,12);
hgd:=if(gg,h,if(dd,L,0));
Lgd:=if(gg,ref(L,wgd),if(dd,ref(h,wgd),0));
yhL:=(hgd-Lgd)/4;
oo:=CROSS(BACKSET(q=BARPOS,wgd[q]+1),0.5);{画箱体横线}
DRAWLINE(oo,Lgd[q]+2*yhl[q],q=BARPOS,Lgd[q]+2*yhl[q],0),POINTDOT,ColorFFCA95;
DRAWLINE(oo,Lgd[q]+4*yhl[q],q=BARPOS,Lgd[q]+4*yhl[q],0),POINTDOT,ColorFFCA95;
DRAWLINE(oo,Lgd[q],q=BARPOS,Lgd[q],0),POINTDOT,ColorFFCA95;
{画箱体竖线}
STICKLINE(oo or q=BARPOS,Lgd[q],hgd[q],0.01,0),POINTDOT,ColorFFCA95;
{画斜线1}
qz:=(wgd[q]);
wdg:=sumbars(gd,2);
k1:=(Lgd[q]-hgd[q])/qz*2,LINETHICK0,Color74AFFF;
g1:hgd[q]+(wdg-1)*k1,LINETHICK0,Color74AFFF;
DRAWSL(oo,hgd[q],k1,0,0),POINTDOT,Color74AFFF;
k2:=(Lgd[q]-hgd[q])/qz,LINETHICK0,Color74AFFF;
g2:hgd[q]+(wdg-1)*k2,LINETHICK0,colorred;
DRAWSL(oo,hgd[q],k2,0,0),Color74AFFF,LINETHICK2;
k3:=(Lgd[q]-hgd[q])/qz/2,LINETHICK0,Color74AFFF;
g3:hgd[q]+(wdg-1)*k3,LINETHICK0,Color74AFFF;
DRAWSL(oo,hgd[q],k3,0,0),POINTDOT,Color74AFFF;
k4:=(Lgd[q]-hgd[q])/qz/4,LINETHICK0,Color74AFFF;
g4:hgd[q]+(wdg-1)*k4,LINETHICK0,Color74AFFF;
DRAWSL(oo,hgd[q],k4,0,0),POINTDOT,Color74AFFF;
//DRAWSL(oo,hgd[q],(Lgd[q]-hgd[q])/qz*3,0,0),POINTDOT,Color74AFFF;
//DRAWSL(oo,hgd[q],(Lgd[q]-hgd[q])/qz*4,0,0),POINTDOT,Color74AFFF;
//DRAWSL(oo,hgd[q],(Lgd[q]-hgd[q])/qz*8,0,0),POINTDOT,Color74AFFF;
{画斜线2}
i1:=(hgd[q]-Lgd[q])/qz*2,LINETHICK0,ColorFF6FB7;
d1:Lgd[q]+(wdg-1)*i1,LINETHICK0,ColorFF6FB7;
DRAWSL(oo,Lgd[q],i1,0,0),POINTDOT,ColorFF6FB7;
i2:=(hgd[q]-Lgd[q])/qz,LINETHICK0,Color74AFFF;
d2:Lgd[q]+(wdg-1)*i2,LINETHICK0,colorgreen;
DRAWSL(oo,Lgd[q],i2,0,0),ColorFF6FB7,LINETHICK2;
i3:=(hgd[q]-Lgd[q])/qz/2,LINETHICK0,ColorFF6FB7;
d3:Lgd[q]+(wdg-1)*i3,LINETHICK0,ColorFF6FB7;
DRAWSL(oo,Lgd[q],i3,0,0),POINTDOT,ColorFF6FB7;
i4:=(hgd[q]-Lgd[q])/qz/4,LINETHICK0,ColorFF6FB7;
d4:Lgd[q]+(wdg-1)*i4,LINETHICK0,ColorFF6FB7;
DRAWSL(oo,Lgd[q],i4,0,0),POINTDOT,ColorFF6FB7;
//DRAWSL(oo,Lgd[q],(hgd[q]-Lgd[q])/qz*3,0,0),POINTDOT,ColorFF6FB7;
//DRAWSL(oo,Lgd[q],(hgd[q]-Lgd[q])/qz*4,0,0),POINTDOT,ColorFF6FB7;
//DRAWSL(oo,Lgd[q],(hgd[q]-Lgd[q])/qz*8,0,0),POINTDOT,ColorFF6FB7;
f:=f>0 or (f=0 and c>ref(c,1));{画K线}
STICKLINE(f,h,l,0.1,0),Color5151FF;
STICKLINE(f,c,o,8,1),Color5151FF;
STICKLINE(not(f),h,l,0.1,0)COLORCYAN;
STICKLINE(not(f),o,c,8,0)COLORCYAN;
xK:='斜率K\n'+'K1\n'+'±'+NUMTOSTR(abs(K1)*100,3)+' \nK2\n'+'±'
+NUMTOSTR(abs(K2)*100,3)+' \nK3\n'+'±'+NUMTOSTR(abs(K3)*100,3)
+' \nK4\n'+'±'+NUMTOSTR(abs(K4)*100,3);
DRAWTEXT(BARPOS=SYSPARAM(3)-5,H,XK),Color74AFFF,ALIGN4;
|