飞狐优化后的箱体主图源码
-
相关简介:飞狐优化后的箱体主图源码 优化后的 箱体 主图 (飞狐源码) DRAWGBK(1, COLORRGB(100,100,100),COLORRGB(50,50,50),0); {-----------------------☆功能开关------------------------} {箱体部分} cc:=c; oo:=o; hh:=h; ll:=l; top:=h; bot:=l; xx[1]:=1; kk:=1; for i=1 to datacount do begin if xx=1 th
-
文章来源:股海网作者:股海网发布时间:2012-05-12浏览次数:
飞狐优化后的箱体主图源码
优化后的 箱体 主图 (飞狐源码)
DRAWGBK(1, COLORRGB(100,100,100),COLORRGB(50,50,50),0);
{-----------------------☆功能开关------------------------}
{箱体部分}
cc:=c;
oo:=o;
hh:=h;
ll:=l;
top:=h;
bot:=l;
xx[1]:=1;
kk:=1;
for i=1 to datacount do begin
if xx=1 then begin
top:=hh;
end;
if xx[i-1]=1 then begin
if hh>top[i-1] then begin
top:=hh;
xx:=1;
end;else begin
top:=top[i-1];
xx:=2;
end;
end;
if xx[i-1]=2 then begin
if hh>top[i-1] then begin
top:=hh;
xx:=1;
end;else begin
top:=top[i-1];
bot:=ll;
xx:=3;
end;
end;
if xx[i-1]=3 then begin
top:=top[i-1];
if ll<bot[i-1] then begin
bot:=ll;
xx:=3;
end;else begin
bot:=bot[i-1];
xx:=4;
end;
end;
if xx[i-1]=4 then begin
top:=top[i-1];
if ll<bot[i-1] then begin
bot:=ll;
xx:=3;
end;else begin
bot:=bot[i-1];
xx:=5;
end;
end;
if xx[i-1]=5 then begin
if ll<bot[i-1] or hh>top[i-1] then begin
top:=hh;
bot:=hh;
xx:=1;
end;else begin
bot:=bot[i-1];
top:=top[i-1];
xx:=5;
end;
end;
end;
for j=1 to datacount do begin
if xx[j]=5 and xx[j-1]=4 then begin
for k=j-1 downto j-kk do begin
top[k]:=top[j];
bot[k]:=bot[j];
end;
end;
if xx[j-1]=5 and xx[j]=1 then kk:=0;
kk:=kk+1;
end;
中位线:=(top+bot)/2;
{股海网提供:www.guhai.com.cn}{信号部分---参考}
买点:=FILTER((TROUGHBARS(3,15,1)<4)=1,3);
卖点:=FILTER((PEAKBARS(3,15,1)<4)=1,3);
{短波--未来}
F:=100*(C-REF(C,1))/REF(C,1);
p1:=IF(C<REF(O,1) AND f<0,1,0);
p3:=IF(C>REF(O,1) AND f>0,1,0);
p2:=IF(C<REF(O,2) AND f<0,1,0);
p4:=IF(C>REF(O,2) AND f>0,1,0);
买D5:=P1=0 AND REF(P1,1)=1 AND P2=0 AND REF(P2,1)=1;
卖D6:=P3=0 AND REF(P3,1)=1 AND P4=0 AND REF(P4,1)=1;
FZ:=PEAK(3,5,1);
FW:=PEAKBARS(3,5,1);
GZ:=TROUGH(3,5,1);
GW:=TROUGHBARS(3,5,1);
AS:=ZIG(3,3);
涨AL:=CROSS(AS,REF(AS,1));
跌AG:=CROSS(REF(AS,1),AS);
Ss1:=IF(FW>GW,FW,0);
Ss2:=IF(FW<GW,GW,0);
Ss3:=BARSLAST(Ss1);
Ss4:=BARSLAST(Ss2);
{-----------------【图解模板】---------------------};
{箱体部分}
PARTLINE(top=ref(top,1),top),Color008293;//箱顶
PARTLINE(bot=ref(bot,1),bot),Color008293;//箱底
STICKLINE((top<>ref(top,1) or bot<>ref(bot,1)) and xx=1 and ref(xx,1)=5,top,bot,1,0),Color008293;//左侧竖线
STICKLINE((top<>refx(top,1) or bot<>refx(bot,1)) and xx=5 and refx(xx,1)=1,top,bot,1,0),Color008293;//右侧竖线
{K线}
STICKLINE(cc>oo,cc,oo,8,1),color5454ff;
STICKLINE(cc>oo,ll,oo,0.9,1),color5454ff;
STICKLINE(cc>oo,hh,cc,0.9,1),color5454ff;
STICKLINE(cc<oo,cc,oo,8,0.5),ColorFFA800;
STICKLINE(cc<oo,hh,ll,0.9,0.5),ColorFFA800;
{信号部分---参考}
{未来}
STICKLINE(买点,L,(O+C)/2,0,0),COLORWHITE; {未来买点}
STICKLINE(买点,C,(O+C)/2,5,0),COLORWHITE; {未来买点}
STICKLINE(卖点,H,(O+C)/2,0,0),COLORYELLOW;{未来卖点}
STICKLINE(卖点,C,(O+C)/2,5,0),COLORYELLOW;{未来卖点}
{短波--未来}
STICKLINE(买D5 and 涨AL,L,(O+C)/2,0,0),COLORWHITE; {未来买}
STICKLINE(买D5 and 涨AL,O,(O+C)/2,5,0),COLORWHITE; {未来买}
STICKLINE(卖D6 and 跌AG,L,(O+C)/2,0,0),Color3EA63E;{未来卖}
STICKLINE(卖D6 and 跌AG,O,(O+C)/2,5,0),Color3EA63E;{未来卖}
{短波--未来--画线写字}
DRAWLINE(FW=0,FZ,GW=0 or ISLASTBAR,REF(FZ,FW),0),Color02A800; //未来--转跌
DRAWLINE(GW=0,GZ,FW=0 or ISLASTBAR,REF(GZ,GW),0),COLORMAGENTA; //未来--转涨
DRAWTEXT(BARPOS=SYSPARAM(2),h,'■上涨第'+NUMTOSTR(Ss4[SYSPARAM(1)],0)+'天'),align4,COLORMAGENTA;//未来
DRAWTEXT(BARPOS=SYSPARAM(2),h,' \n■下跌第'+NUMTOSTR(Ss3[SYSPARAM(1)],0)+'天'),align4,COLORCYAN;//未来
{箱体部分}
PARTLINE(top=ref(top,1),中位线),LINEDOT,Color008293;//中位线
MA3:="Hotstock@QY"(5);
MA5:="Hotstock@QY"(5);
DRAWTEXT(CLOSE>0 AND SYSPARAM(2)=BARPOS,HIGH,'所属板块:'+BLKNAME),ALIGN4,colorFFFFFF;
G:=IF(HIGH=HHV(HIGH,3),1,0);
D:=IF(LOW=LLV(LOW,3),1,0);
S:=IF(REF(G,2)=1 AND REF(G,1)=0 AND G=0,REF(HIGH,2),REF(HIGH,2+BARSLAST(REF(G,2)=1 AND REF(G,1)=0 AND G=0)));
X:=IF(REF(D,2)=1 AND REF(D,1)=0 AND D=0,REF(LOW,2),REF(LOW,2+BARSLAST(REF(D,2)=1 AND REF(D,1)=0 AND D=0)));
K1:=IF(HIGH>=MA(CLOSE,1),S,REF(S,BARSLAST(HIGH>MA(CLOSE,1))));
K2:=IF(LOW<=MA(CLOSE,5),X,REF(X,BARSLAST(LOW<=MA(CLOSE,5))));
C1:=REF(CLOSE,1)<=K1 AND CLOSE>K1;
C2:=REF(CLOSE,1)>=K2 AND CLOSE<K2;
K3:=BARSLAST(C1)*MA3/MA5;
K4:=BARSLAST(C2)*MA3/MA5;
PARTLINE(K3<K4,K2),LINETHICK2,colorFFFF;
PARTLINE(K3>K4,K1),LINETHICK2,colorFFFFFF;
K0:=K3<K4;
STICKLINE(K0,HIGH,LOW,0.1,1),colorFF;
STICKLINE(K0 AND CLOSE>=OPEN,CLOSE,OPEN,8,1),colorFF;
STICKLINE(K0 AND CLOSE<OPEN,CLOSE,OPEN,8,0),colorFF;
STICKLINE(NOT(K0),HIGH,LOW,0.1,0),colorFF00;
STICKLINE(NOT(K0) AND CLOSE>OPEN,CLOSE,OPEN,8,1),colorFF00;
STICKLINE(NOT(K0) AND CLOSE<=OPEN,CLOSE,OPEN,8,0),colorFF00;
标准:IF(K3>K4,HHV(K1,BARSLAST(C1)),LLV(K2,BARSLAST(C2))),LINETHICK0;
顾比:="Hotstock@QY"(5);
STICKLINE(BETWEEN(CLOSE,标准,顾比),HIGH,LOW,0.1,1),colorFF00FF;
STICKLINE(BETWEEN(CLOSE,标准,顾比),CLOSE,OPEN,8,1),colorFF00FF;
PARTLINE(BETWEEN(CLOSE,标准,顾比),顾比),LINETHICK2,colorFFFF00;
BH:=PEAKBARS(4,15,1)+1;
BLL:=LLV(LOW,BH);
BTJ1:=BLL=LOW AND (BLL<REF(BLL,1) OR BH=1);
BTS:=SUMBARS(BTJ1,3)-1;
BTJ:=TROUGHBARS(4,15,1)=0 AND BTS<=BH;
DRAWICON(BTJ,LOW,10);
DRAWSL(BTJ,REF(HIGH,BTS),0,BTS,1),colorFF;
BL:=BARSLAST(BTJ);
BTJ_2:=CLOSE>REF(REF(HIGH,BTS),BL);
DRAWICON(COUNT(BTJ_2,BL+1)=1 AND BTJ_2,LOW,4);
DRAWTEXT(BTJ AND MA3=MA5,LOW,'-------'),colorFF00;