标题: [飞狐] 飞狐不错的周月K线源码公式 [打印本页] 作者: 我是美女 时间: 2009-9-23 21:17 标题: [飞狐] 飞狐不错的周月K线源码公式 飞狐不错的周月K线源码公式:
TBS:=POW(10,ABS(LOG(MINDIFF)));
//周线
BZ:=WEEKDAY;ZB:=DATEDIFF(REF(DATE,1),DATE)<>BZ-REF(BZ,1) OR BARPOS=1;
ZW:=BARSLAST(ZB),LINETHICK;
Zdg:=ZW=0 or ISLASTBAR;
Zwx:=0*c;
for i=datacount-1 downto lbound(Zdg) do
if Zdg then
Zwx:=0;
else
Zwx:=Zwx[i+1]+1;
Zr:=BACKSET(ISLASTBAR,Zw+1)-ISLASTBAR;
Zwx:=refx(Zwx,1)+Zr,LINETHICK;
zq:=BARSLAST(ref(Zwx,1)=0 or BARPOS=1)+1;
Zo:=ref(o,Zw);
Zh:=hhv(h,Zw+1);
ZL:=LLv(L,Zw+1);
周开:ROUND(ZO*TBS)/TBS,LINETHICK;
周高:ROUND(refx(Zh,Zwx)*TBS)/TBS,,COLORFF,LINETHICK;
周低:ROUND(refx(ZL,Zwx)*TBS)/TBS,COLORFF00,LINETHICK;
周收:ROUND(refx(c,Zwx)*TBS)/TBS,,COLORFF00FF,LINETHICK;
ZF:=周收>周开 or (周收=周开 and 周收>ref(周收,Zw+1));
Zj:=cross(Zw,Zwx);// OR ISLASTBAR;
yt:=if(zq=1 and refx(zq,2)=1,13,if(refx(zq,1)=1 or zq=1,7,14));
//影线
STICKLINE(Zw>0 and ZF and Zj,周低,周高,1,0)COLORAAAAEE;
STICKLINE(周开<周收,周开,周收,YT,0),COLORAAAAEE;
STICKLINE(Zw>0 and not(ZF) and Zj,周低,周高,1,0)COLOREEAAAA;
STICKLINE(周开>周收,周开,周收,YT,0),COLOREEAAAA;
//日线
TJ:=CLOSE>OPEN or CLOSE=OPEN and CLOSE>REF(CLOSE,1);
STICKLINE(TJ,LOW,HIGH,1,0),ColorE9;
STICKLINE(TJ,LOW,CLOSE,8,0),Color80;
STICKLINE(TJ,LOW,CLOSE,6,0),ColorA5;
STICKLINE(TJ,LOW,CLOSE,4,0),ColorC0;
STICKLINE(TJ,LOW,CLOSE,2,0),ColorE6;
//月线
BY:=MONTH;YB:=BY-REF(BY,1)<>0 OR BARPOS=1;
w:=BARSLAST(YB),LINETHICK;
dg:=w=0 or ISLASTBAR;
wx:=0*C;
for i=datacount-1 downto lbound(dg) do
if dg then
wx:=0;
else
wx:=wx[i+1]+1;
r:=BACKSET(ISLASTBAR,w+1)-ISLASTBAR;
wx:=refx(wx,1)+r,LINETHICK;
oo:=ref(o,w);
hh:=hhv(h,w+1);
LL:=LLv(L,w+1);
月开:ROUND(OO*TBS)/TBS,LINETHICK;
月高:ROUND(refx(hh,wx)*TBS)/TBS,LINETHICK;
月低:ROUND(refx(LL,wx)*TBS)/TBS,LINETHICK;
月收:ROUND(refx(c,wx)*TBS)/TBS,LINETHICK;
f:=月收>月开 or (月收=月开 and 月收>ref(月收,w+1));
j:=cross(w,wx);// OR ISLASTBAR;
//画横线
PARTLINE(w>0 and f,月收)COLORMAGENTA;
PARTLINE(w>0 and f,月开)COLORMAGENTA;
//影线
STICKLINE(w>0 and f and j,月收,月高,1,0),COLORMAGENTA;
STICKLINE(w>0 and f and j,月开,月低,1,0),COLORMAGENTA;
STICKLINE(w=0 and f ,月收,月开,1,0),COLORMAGENTA;
STICKLINE((refx(w=0,1) or ISLASTBAR) and f,月开,月收,1,0),COLORMAGENTA;
PARTLINE(w>0 and not(f),月收),COLORFFDD00;
PARTLINE(w>0 and not(f),月开),COLORFFDD00;
STICKLINE(w>0 and not(f) and j,月开,月高,1,0)COLORFFDD00;
STICKLINE(w>0 and not(f) and j,月收,月低,1,0)COLORFFDD00;
STICKLINE(w=0 and not(f),月开,月收,1,0)COLORFFDD00;
STICKLINE((refx(w=0,1) or ISLASTBAR) and not(f),月收,月开,1,0)COLORFFDD00;
//TBS:=POW(10,ABS(LOG(MINDIFF)));
//周线
BZ:=WEEKDAY;ZB:=DATEDIFF(REF(DATE,1),DATE)<>BZ-REF(BZ,1) OR BARPOS=1;
ZW:=BARSLAST(ZB),LINETHICK;
Zdg:=ZW=0 or ISLASTBAR;
Zwx:=0*c;
for i=datacount-1 downto lbound(Zdg) do
if Zdg then
Zwx:=0;
else
Zwx:=Zwx[i+1]+1;
Zr:=BACKSET(ISLASTBAR,Zw+1)-ISLASTBAR;
Zwx:=refx(Zwx,1)+Zr,LINETHICK;
zq:=BARSLAST(ref(Zwx,1)=0 or BARPOS=1)+1;
Zo:=ref(o,Zw);
Zh:=hhv(h,Zw+1);
ZL:=LLv(L,Zw+1);
周开:ROUND(ZO*TBS)/TBS,LINETHICK;
周高:ROUND(refx(Zh,Zwx)*TBS)/TBS,,COLORFF,LINETHICK;
周低:ROUND(refx(ZL,Zwx)*TBS)/TBS,COLORFF00,LINETHICK;
周收:ROUND(refx(c,Zwx)*TBS)/TBS,,COLORFF00FF,LINETHICK;
ZF:=周收>周开 or (周收=周开 and 周收>ref(周收,Zw+1));
Zj:=cross(Zw,Zwx);// OR ISLASTBAR;
yt:=if(zq=1 and refx(zq,2)=1,13,if(refx(zq,1)=1 or zq=1,7,14));
//影线
STICKLINE(Zw>0 and ZF and Zj,周低,周高,1,0)COLORAAAAEE;
STICKLINE(周开<周收,周开,周收,YT,0),COLORAAAAEE;
STICKLINE(Zw>0 and not(ZF) and Zj,周低,周高,1,0)COLOREEAAAA;
STICKLINE(周开>周收,周开,周收,YT,0),COLOREEAAAA;
//日线
TJ:=CLOSE>OPEN or CLOSE=OPEN and CLOSE>REF(CLOSE,1);
STICKLINE(TJ,LOW,HIGH,1,0),ColorE9;
STICKLINE(TJ,LOW,CLOSE,8,0),Color80;
STICKLINE(TJ,LOW,CLOSE,6,0),ColorA5;
STICKLINE(TJ,LOW,CLOSE,4,0),ColorC0;
STICKLINE(TJ,LOW,CLOSE,2,0),ColorE6;
//月线
BY:=MONTH;YB:=BY-REF(BY,1)<>0 OR BARPOS=1;
w:=BARSLAST(YB),LINETHICK;
dg:=w=0 or ISLASTBAR;
wx:=0*C;
for i=datacount-1 downto lbound(dg) do
if dg then
wx:=0;
else
wx:=wx[i+1]+1;
r:=BACKSET(ISLASTBAR,w+1)-ISLASTBAR;
wx:=refx(wx,1)+r,LINETHICK;
oo:=ref(o,w);
hh:=hhv(h,w+1);
LL:=LLv(L,w+1);
月开:ROUND(OO*TBS)/TBS,LINETHICK;
月高:ROUND(refx(hh,wx)*TBS)/TBS,LINETHICK;
月低:ROUND(refx(LL,wx)*TBS)/TBS,LINETHICK;
月收:ROUND(refx(c,wx)*TBS)/TBS,LINETHICK;
f:=月收>月开 or (月收=月开 and 月收>ref(月收,w+1));
j:=cross(w,wx);// OR ISLASTBAR;
//画横线
PARTLINE(w>0 and f,月收)COLORMAGENTA;
PARTLINE(w>0 and f,月开)COLORMAGENTA;
//影线
STICKLINE(w>0 and f and j,月收,月高,1,0),COLORMAGENTA;
STICKLINE(w>0 and f and j,月开,月低,1,0),COLORMAGENTA;
STICKLINE(w=0 and f ,月收,月开,1,0),COLORMAGENTA;
STICKLINE((refx(w=0,1) or ISLASTBAR) and f,月开,月收,1,0),COLORMAGENTA;
PARTLINE(w>0 and not(f),月收),COLORFFDD00;
PARTLINE(w>0 and not(f),月开),COLORFFDD00;
STICKLINE(w>0 and not(f) and j,月开,月高,1,0)COLORFFDD00;
STICKLINE(w>0 and not(f) and j,月收,月低,1,0)COLORFFDD00;
STICKLINE(w=0 and not(f),月开,月收,1,0)COLORFFDD00;
STICKLINE((refx(w=0,1) or ISLASTBAR) and not(f),月收,月开,1,0)COLORFFDD00;
/:G input:ZQ(60,5,300);
DRAWGBK(1,COLORRGB(50,50,50),COLORRGB(0,0,0),1);
{筹码中心部分}
W00:=COST(1);W10:=COST(10);W20:=COST(20);W30:=COST(30);W40:=COST(40);W50:=COST(50);W60:=COST(60);W70:=COST(70);W80:=COST(80);W90:=COST(90);
W100:=COST(99);W5:=COST(5);W15:=COST(15);W25:=COST(25);W35:=COST(35);W45:=COST(45);W55:=COST(55);W65:=COST(65);W75:=COST(75);W85:=COST(85);
W95:=COST(95);
C5:=(W5 - W00);C10:=(W10 - W5);C15:=(W15 - W10);C20:=(W20 - W15);C25:=(W25 - W20);C30:=(W30 - W25);C35:=(W35 - W30);C40:=(W40 - W35);C45:=(W45 - W40);
C50:=(W50 - W45);C55:=(W55 - W50);C60:=(W60 - W55);C65:=(W65 - W60);C70:=(W70 - W65);C75:=(W75 - W70);C80:=(W80 - W75);C85:=(W85 - W80);C90:=(W90 - W85);
C95:=(W95 - W90);C100:=(W100 - W95);
ZX:=MIN(C5,MIN(C10,MIN(C15,MIN(C20,MIN(C25,MIN(C30,MIN(C35,MIN(C40,MIN(C45,MIN(C50,MIN(C55,MIN(C60,MIN(C65,MIN(C70,MIN(C75,MIN(C80,MIN(C85,MIN(C90,MIN(C95,C100)))))))))))))))))));
FILLRGN((ZX = C5),W00,W5),color808080;
FILLRGN((ZX = C10),W10,W5),color808080;
FILLRGN((ZX = C15),W15,W10),color808080;
FILLRGN((ZX = C20),W20,W15),color808080;
FILLRGN((ZX = C25),W25,W20),color808080;
FILLRGN((ZX = C30),W30,W25),color808080;
FILLRGN((ZX = C35),W35,W30),color808080;
FILLRGN((ZX = C40),W40,W35),color808080;
FILLRGN((ZX = C45),W45,W40),color808080;
FILLRGN((ZX = C50),W50,W45),color808080;
FILLRGN((ZX = C55),W55,W50),color808080;
FILLRGN((ZX = C60),W60,W55),color808080;
FILLRGN((ZX = C65),W65,W60),color808080;
FILLRGN((ZX = C70),W70,W65),color808080;
FILLRGN((ZX = C75),W75,W70),color808080;
FILLRGN((ZX = C80),W80,W75),color808080;
FILLRGN((ZX = C85),W85,W70),color808080;
FILLRGN((ZX = C90),W90,W85),color808080;
FILLRGN((ZX = C95),W95,W90),color808080;
FILLRGN((ZX = C100),W100,W95),color808080;