自由週期K線
這是CWY兄寫的
不知是否合乎您需要
N:=3;//自定義週期參數
zq:=mod(barpos,n)=1;ts:=barslast(zq);s:=if(ts>ref(ts,1),1,0);
zqdw:=backset(ts=0,ts+2);
z:=cross(backset(ts=0,ref(ts,1)/2+2),0.5);
zjts:=round(ts[datacount]/2);
zjz:=cross(backset(islastbar,zjts),0.5);
h1:=hhv(h,ts+1);l1:=llv(l,ts+1);o1:=(ts=0)*o;
c1:=if(zqdw=1 and ts>0,c,if(barstatus=2,c,0));
ft:=ts;rt:=ref(ts,1);x:=0*c;
for i= datacount downto 2 do begin
if ft[i]>rt[i] then
x[i-1]:=x[i]+s[i];
end
o2:ref(o1,ts),linethick0;c2:refx(c1,x),linethick0;
h2:refx(h1,x),linethick0;l2:refx(l1,x),linethick0;
k:=c2>o2 or c2=o2 and c2>ref(c2,ts);tj1:=z or zjz;
tj:=ts=0 or barstatus=2 or zqdw=1and ts>ref(ts,1);
partline(ts and k,o2)COLORRED;
partline(ts and k,c2)COLORRED;
partline(ts and not(k),o2)COLORCYAN;
partline(ts and not(k),c2)COLORCYAN;
STICKLINE(tj1 and k,h2,c2,0.1,1)COLORRED;
STICKLINE(tj1 and k,l2,o2,0.1,1)COLORRED;
STICKLINE(tj1 and not(k),h2,o2,0.1,1)COLORCYAN;
STICKLINE(tj1 and not(k),l2,c2,0.1,1)COLORCYAN;
STICKLINE(tj and k,o2,c2,0.1,1)COLORRED;
STICKLINE(tj and not(k),o2,c2,0.1,1)COLORCYAN;
STICKLINE(barstatus=2 and ts<1and k,h2,l2,0.1,1)COLORRED;
STICKLINE(barstatus=2 and ts<1and k,o2,c2,8,1)COLORRED;
STICKLINE(barstatus=2 and ts<1and not(k),h2,l2,0.1,1)COLORCYAN;
STICKLINE(barstatus=2 and ts<1and not(k),o2,c2,8,1)COLORCYAN;
__________________
至誠能勝天下至偽
至拙能勝天下至巧
|