砖块线和价格运动曲线指标源码
二个指标都是以涨跌幅度计算,可根据自己需要用参数调整涨跌幅度大小。
复制内容到剪贴板
代码:
1:价格运动曲线
INPUT:N(10,1,100);
fc:=c;fo:=o;x:=0*c;t1:=0*c;
for i=1 to datacount do begin
if i=1 and fc[i]>=fo[i] then
x[i]:=fc[i];
if i=1 and fc[i]<=fo[i] then
x[i]:=fc[i];
if i>1 then
x[i]:=x[i-1];
if i>1 and fc[i]>x[i-1]*(1+n/100) then
x[i]:=x[i-1]*(1+n/100);
if i>1 and fc[i]<x[i-1]/(1+n/100) then
x[i]:=x[i-1]/(1+n/100);
if x[i]=x[i-1] then
t1[i]:=t1[i-1]+1;
end;
cc:x,LINETHICK0;
x1:=ref(x,t1+1);
x2:=ref(x1,t1+1);
y:=BARSSINCE(x>ref(x,1))+1;
y1:=BARSSINCE(x<ref(x,1))+1;
k1:=BARSLAST(cross(x>x2,0.5)or y1=1);
d1:=BARSLAST(cross(x<x2,0.5)or y=1);
PARTLINE(d1>k1,x)COLORRED;
PARTLINE(d1<k1,x)COLORCYAN;
ks:=BARPOS;
ks1:=BARSSINCE(cross(x<x2,0.5) or cross(x>x2,0.5));
fk:=ks-ks1;
xk:=0*c;
b:=fk[datacount];
for i=b to DATACOUNT do begin
if fk[i]>1 then
xk[i]:=xk[i-1]+1;
else
xk[i]:=xk[i-1]+2;
end
tj:=if(xk<1,1,0);
PARTLINE(tj=1 and y>=1,x)COLORRED;
PARTLINE(tj=1 and y1>=1,x)COLORCYAN;
2:砖块线
INPUT:N(10,1,100);
fc:=c;fo:=o;cc:0*c,LINETHICK0;oo:0*c,LINETHICK0;t1:=0*c;t2:=0*c;
for i=1 to datacount do begin
if i=1 and fc[i]>fo[i] then
cc[i]:=fc[i];
oo[i]:=fc[i];
if i=1 and fc[i]<fo[i] then
cc[i]:=fc[i];
oo[i]:=fc[i];
if i>1 then
cc[i]:=cc[i-1];
oo[i]:=oo[i-1];
if i>1 and fc[i]>cc[i]*(1+n/100) then begin
cc[i]:=cc[i-1]*(1+n/100);
oo[i]:=cc[i-1];
end;
if i>1 and fc[i]<oo[i]/(1+n/100) then begin
oo[i]:=oo[i-1]/(1+n/100);
cc[i]:=oo[i-1];
end;
if oo[i]=oo[i-1] then
t1[i]:=t1[i-1]+1;
if cc[i]=cc[i-1] then
t2[i]:=t2[i-1]+1;
end;
o1:=ref(oo,t1+1);
c1:=ref(cc,t2+1);
STICKLINE(c1=oo,cc,oo,8,1)COLORRED;
STICKLINE(o1=cc,cc,oo,8,1)COLORCYAN; 本贴由 cwy 于 2006-1-3 21:56 最后编辑