公式源码:
//本公式只是为了引用,不必调入
fx:"chzhshch@fenxing"(),OwnerScale;
var1:"chzhshch@kxian"(),OwnerScale;
var2:"chzhshch@bi"(),OwnerScale;//处理笔关系
var3:"chzhshch@duan"(),OwnerScale//处理段关系
第三步:建立悟多笔段公式
公式源码:
//悟多笔段
SH000001 P_DAY
#mainchart
if dataType=0 then
minbi:="fbase.var2#min1";
if dataType=1 then
minbi:="fbase.var2#min5";
if dataType=2 then
minbi:="fbase.var2#min30";
if dataType=3 then
minbi:="fbase.var2#min60";
if dataType=4 then
minbi:="fbase.var2#day";
if dataType=5 then
minbi:="fbase.var2#day";
if dataType=6 then
minbi:="fbase.var2#week";
if dataType=7 then
minbi:="fbase.var2#month";
if dataType=8 then minbi:="fbase.var2#year";
var1:="chzhshch@kxian"();
var2:="chzhshch@bi"();{处理笔关系}
var3:="chzhshch@tongji"(minbi);{同级别分解}
zg:="chzhshch@zg"(var3);//一定要先调用ZG
zd:="chzhshch@zd"(var3);
pre:=2; //设置小数点位数
if STKTYPE=0
then pre:=1;
if STKTYPE=11 then pre:=3;
//以背景块的形式画中枢
stickline(zg>zd,zg,zd,10,0),color000055;
drawline(var2=1,h,var2=-1,l,0),linedot,coloryellow;
drawline(var2=-1,l,var2=1,h,0),linedot,coloryellow;
drawline(var3=1,h,var3=-1,l,0),colorFF6600;
drawline(var3=-1,l,var3=1,h,0),colorFF6600;
//以框的形式画中枢
{
stickline(zg>zd and
zg<>ref(zg,1),zg,zd,2,0),COLORMAGENTA;
stickline(zg>zd and
zg<>refx(zg,1),zg,zd,2,0),COLORMAGENTA;
drawline(zg>zd and zg<>ref(zg,1),zg,zg>zd and
zg<>refx(zg,1),zg,0),COLORMAGENTA;
drawline(zg>zd and zd<>ref(zd,1),zd,zg>zd and
zd<>refx(zd,1),zd,0),COLORMAGENTA;
}
var1:="chzhshch@kxian"();
var2:="chzhshch@bi"();{处理笔关系}
if dataType<=1 then
begin var2:=var3;{处理段1分钟的关系}
end;
pre:=2; {设置小数点位数}
if STKTYPE=0
then pre:=1;
if STKTYPE=11 then pre:=3;
a1:=barslast(var2<>0);
a2:=ref(var2,a1);
aa1:=ref(a1+1,1);
aa2:=ref(a2,1);
a3:=if
(aa2>0,l-ref(h,aa1),h-ref(l,aa1)),linethick0;{计算点位差}
//显示点位
drawnumber(var2=1,h,h,pre),pxup65,color3300ff,align0;
drawnumber(var2=-1,l,l,pre),pxdn50,colorffff00,align0;
//显示力度
drawtext(var2=1,h,'+')colormagenta,pxup20,align2;
drawnumber(var2=1,h,a3,pre),colormagenta,pxup20;
drawnumber(var2=-1,l,a3,pre),colorgreen,pxdn5,align0;
//显示周期数
drawtext(var2=1,h,'T'),pxup45,coloryellow,align1;
drawnumber(var2=1,h,aa1,0),coloryellow,pxup45,align2;
drawtext(var2=-1,l,'T'),pxdn30,coloryellow,align1;
drawnumber(var2=-1,l,aa1,0),coloryellow,pxdn30,align2;
kline(o,h,l,c,1);
stickline(dataType=6 and
c/ref(c,1)>=1.097,o,c,8,1);
//显示最后没完成的点位
aa9:=hhv(h,a1);
aa11:=llv(l,a1);
drawnumber( islastbar and
a2=-1,aa9,aa9,pre),align2,color3300ff;
drawnumber( islastbar and
a2=1,aa11,aa11,pre),align2,colorffff00;
//显示最后没完成的力度
drawtext( islastbar and a2=-1,
aa9,'+ '),align2,colormagenta,pxdn20;
drawnumber( islastbar and a2=-1,
aa9,a3,pre),align2,colormagenta,pxdn20;
drawnumber( islastbar and a2=1,
aa11,a3,pre),align2,colorgreen,pxup20;
//显示最后没完成的周期
drawtext( islastbar and
a2=-1, aa9,'T'),coloryellow,align1,pxdn40;
drawnumber(islastbar and
a2=-1, aa9,aa1,0),coloryellow,align2,pxdn40;
drawtext( islastbar and a2=1,
aa11,'T'),coloryellow,align1,pxup40;
drawnumber(islastbar and a2=1,
aa11,aa1,0),coloryellow,align2,pxup40;