以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  使用了循环语句  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=161889)

--  作者:PBTCA
--  发布时间:2018/3/7 4:40:07
--  使用了循环语句
面是我以前用的三线反转图,转到金字塔中后出现问题,说是使用了循环语句,请帮我改正,另外,请加上开平仓语句。

 

 

VARIABLE:
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;


谢谢!


--  作者:yukizzc
--  发布时间:2018/3/7 11:25:36
--  

没有问题的,编译能够通过

那个只是提示并非是出错


--  作者:PBTCA
--  发布时间:2018/3/7 14:45:55
--  

老师您好,

能否帮我加个开平仓的语句?


--  作者:yukizzc
--  发布时间:2018/3/7 15:24:29
--  

for i=2 to datacount do

这种循环都是有未来的在历史上,无法用在图表程序中了