fc:=close,fh:=h,fl:=l,fcolor:=0,ft1:=0,fb1:=0,fi:=0,t[4]=0,b[4]=0,pt=1,pb=1;
if datacount<2 then exit;
for i=1 to 4 do begin t[i]:=i;b[i]:=1; end; for i=2 to datacount do begin
if fc[i]>fc[t[pt]] then begin
fh[i]:=fc[i];fl[i]:=fc[t[1]];fcolor[i]:=1; b[4]:=b[3];b[3]:=b[2];b[2]:=b[1];b[1]:=t[1]; t[4]:=t[3];t[3]:=t[2];t[2]:=t[1];t[1]:=i; pt:=1;
pb:=if(pb=3,3,pb+1); end;
else if fc[i]<fc[b[pb]] then begin
fh[i]:=fc[b[1]];fl[i]:=fc[i];fcolor[i]:=-1; t[4]:=t[3];t[3]:=t[2];t[2]:=t[1];t[1]:=b[1]; b[4]:=b[3];b[3]:=b[2];b[2]:=b[1];b[1]:=i; pb:=1;
pt:=if(pt=3,3,pt+1); end;
else if fc[i]<=fc[t[pt]] and fc[i]>=fc[b[pb]] then begin
fh[i]:=fh[i-1];fl[i]:=fl[i-1]; fcolor[i]:=fcolor[i-1]; end;
ft1[i]:=t[1];fb1[i]:=b[1];fi[i]:=i; end;
STICKLINE(fcolor=1,fh,fl,10,0) colorred; STICKLINE(fcolor=-1,fh,fl,10,0) colorgreen;
麻烦老师修改成金字塔的公式,谢谢
fc:=close,fh:=h,fl:=l;fcolor:=0;ft1:=0;fb1:=0;fi:=0;t[4]:=0;b[4]:=0;pt:=1;pb:=1;
if datacount<2 then exit;
for i=1 to 4 do begin t[i]:=i;b[i]:=1; end; for i=2 to datacount do begin
if fc[i]>fc[t[pt]] then begin
fh[i]:=fc[i];fl[i]:=fc[t[1]];fcolor[i]:=1; b[4]:=b[3];b[3]:=b[2];b[2]:=b[1];b[1]:=t[1]; t[4]:=t[3];t[3]:=t[2];t[2]:=t[1];t[1]:=i; pt:=1;
pb:=if(pb=3,3,pb+1); end;
else if fc[i]<fc[b[pb]] then begin
fh[i]:=fc[b[1]];fl[i]:=fc[i];fcolor[i]:=-1; t[4]:=t[3];t[3]:=t[2];t[2]:=t[1];t[1]:=b[1]; b[4]:=b[3];b[3]:=b[2];b[2]:=b[1];b[1]:=i; pb:=1;
pt:=if(pt=3,3,pt+1); end;
else if fc[i]<=fc[t[pt]] and fc[i]>=fc[b[pb]] then begin
fh[i]:=fh[i-1];fl[i]:=fl[i-1]; fcolor[i]:=fcolor[i-1]; end;
ft1[i]:=t[1];fb1[i]:=b[1];fi[i]:=i; end;
STICKLINE(fcolor=1,fh,fl,10,0) colorred; STICKLINE(fcolor=-1,fh,fl,10,0) colorgreen;
红柱条件fcolor=1
绿柱条件fcolor=-1
请先尝试自行修改一下
上面的公式不能用在逐k线模式下,
数组引用了未来的数据,能不能讲一下上面的代码是什么意思吗?
fc:=close,fh:=h,fl:=l;fcolor:=0;ft1:=0;fb1:=0;fi:=0;t[4]:=0;b[4]:=0;pt:=1;pb:=1;
if datacount<2 then exit;
for i=1 to 4 do begin t[i]:=i;b[i]:=1; end; for i=2 to datacount do begin
if fc[i]>fc[t[pt]] then begin
fh[i]:=fc[i];fl[i]:=fc[t[1]];fcolor[i]:=1; b[4]:=b[3];b[3]:=b[2];b[2]:=b[1];b[1]:=t[1]; t[4]:=t[3];t[3]:=t[2];t[2]:=t[1];t[1]:=i; pt:=1;
pb:=if(pb=3,3,pb+1); end;
else if fc[i]<fc[b[pb]] then begin
fh[i]:=fc[b[1]];fl[i]:=fc[i];fcolor[i]:=-1; t[4]:=t[3];t[3]:=t[2];t[2]:=t[1];t[1]:=b[1]; b[4]:=b[3];b[3]:=b[2];b[2]:=b[1];b[1]:=i; pb:=1;
pt:=if(pt=3,3,pt+1); end;
else if fc[i]<=fc[t[pt]] and fc[i]>=fc[b[pb]] then begin
fh[i]:=fh[i-1];fl[i]:=fl[i-1]; fcolor[i]:=fcolor[i-1]; end;
ft1[i]:=t[1];fb1[i]:=b[1];fi[i]:=i; end;
STICKLINE(fcolor=1,fh,fl,10,0) colorred; STICKLINE(fcolor=-1,fh,fl,10,0) colorgreen;
exitshort:fcolor=1,tfilter;
enterlong:fcolor=1,tfilter;
exitlong:fcolor=-1,tfilter;
entershort:fcolor=-1,tfilter;
如果不能解释上面代码的含义,那么就推荐这段旧图表交易了,可以开平仓,止盈止损不能写在代码里面,需要金字塔自带的止盈止损功能实施