{自由周期K线(调整指标参数)飞狐版-原作 知无不言(cwy)-调整 理想 刘松何柏—(加了个参数 M 调整大于1的数可以设定多周期K线的画出的起始点,默认1不调为上市首日)-注:原公式参数 N 当调整到小于4的值时,画出的K线不带上下影线-此处未修正}
源码
{自由周期K线(调整指标参数)飞狐版-原作 知无不言(cwy)-调整 理想 刘松何柏—(加了个参数 M 调整大于1的数可以设定多周期K线的画出的起始点,默认1不调为上市首日)-注:原公式参数 N 当调整到小于4的值时,画出的K线不带上下影线-此处未修正}
INPUT:N(9,1,1000),M(1,1,100);
BAR:=(BARPOS-M+1);
zq:=mod(bar,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 M+1 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;