以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]请版主帮忙看看如何编译成金字塔的  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=15434)

--  作者:winewine99
--  发布时间:2012/8/25 20:19:16
--  [求助]请版主帮忙看看如何编译成金字塔的

INPUT: nH(5,3,100), nL(5,3,100);
fH:=H;
fL:=L;
CBH:=HHV(H,3);
tH:=HHV(H,nH);
for i=nH+1 to datacount do begin
   if fH[i] < tH[i]                                                   then  CBH[i]:=tH[i-1]
   else if fL[i-2] < fL[i-1] and fL[i-2] < fL[i]
       and fL[i-1] < fL[i]                                            then  CBH[i]:=fL[i-2]
   else if nH > 3 and fL[i-3] < fL[i-2] and fL[i-3] < fL[i-1]
       and fL[i-3] < fL[i] and (fL[i-2] < fL[i] or fL[i-1] < fL[i])   then  CBH[i]:=fL[i-3]
   else if nH > 4 and fL[i-4] < fL[i-3] and fL[i-4] < fL[i-2]
       and fL[i-4] < fL[i-1] and fL[i-4] < fL[i]
       and (fL[i-3] < fL[i] or fL[i-2] < fL[i] or fL[i-1] < fL[i])    then  CBH[i]:=fL[i-4]
   else if nH > 5 and fL[i-5] < fL[i-4] and fL[i-5] < fL[i-3]
       and fL[i-5] < fL[i-2] and fL[i-5] < fL[i-1]
       and fL[i-5] < fL[i]
       and (fL[i-4] < fL[i] or fL[i-3] < fL[i] or fL[i-2] < fL[i] or fL[i-1] < fL[i])  then  CBH[i]:=fL[i-4];
end;

CBH;

CBL:=LLV(L,3);
tL:=LLV(L,nL);
for i=nL+1 to datacount do begin
   if fL[i] > tL[i]                                                   then  CBL[i]:=tL[i-1]
   else if fH[i-2] > fH[i-1] and fH[i-2] > fH[i]
       and fH[i-1] > fH[i]                                            then  CBL[i]:=fH[i-2]
   else if nL > 3 and fH[i-3] > fH[i-2] and fH[i-3] > fH[i-1]
       and fH[i-3] > fH[i] and (fH[i-2] > fH[i] or fH[i-1] > fH[i])   then  CBL[i]:=fH[i-3]
   else if nL > 4 and fH[i-4] > fH[i-3] and fH[i-4] > fH[i-2]
       and fH[i-4] > fH[i-1] and fH[i-4] > fH[i]
       and (fH[i-3] > fH[i] or fH[i-2] > fH[i] or fH[i-1] > fH[i])    then  CBL[i]:=fH[i-4]
   else if nL > 5 and fH[i-5] > fH[i-4] and fH[i-5] > fH[i-3]
       and fH[i-5] > fH[i-2] and fH[i-5] > fH[i-1]
       and fH[i-5] > fH[i]
       and (fH[i-4] > fH[i] or fH[i-3] > fH[i] or fH[i-2] > fH[i] or fH[i-1] > fH[i])  then  CBL[i]:=fH[i-4];
end;

CBL;



--  作者:jinzhe
--  发布时间:2012/8/27 8:57:02
--  

INPUT: nH(5,3,100), nL(5,3,100);
fH:=H;
fL:=L;
CBH:=HHV(H,3);
tH:=HHV(H,nH);
for i=nH+1 to datacount do begin
   if fH[i] < tH[i]                                                   then  CBH[i]:=tH[i-1]
   else if fL[i-2] < fL[i-1] and fL[i-2] < fL[i]
       and fL[i-1] < fL[i]                                            then  CBH[i]:=fL[i-2]
   else if nH > 3 and fL[i-3] < fL[i-2] and fL[i-3] < fL[i-1]
       and fL[i-3] < fL[i] and (fL[i-2] < fL[i] or fL[i-1] < fL[i])   then  CBH[i]:=fL[i-3]
   else if nH > 4 and fL[i-4] < fL[i-3] and fL[i-4] < fL[i-2]
       and fL[i-4] < fL[i-1] and fL[i-4] < fL[i]
       and (fL[i-3] < fL[i] or fL[i-2] < fL[i] or fL[i-1] < fL[i])    then  CBH[i]:=fL[i-4]
   else if nH > 5 and fL[i-5] < fL[i-4] and fL[i-5] < fL[i-3]
       and fL[i-5] < fL[i-2] and fL[i-5] < fL[i-1]
       and fL[i-5] < fL[i]
       and (fL[i-4] < fL[i] or fL[i-3] < fL[i] or fL[i-2] < fL[i] or fL[i-1] < fL[i])  then  CBH[i]:=fL[i-4];
end;

CBH;

CBL:=LLV(L,3);
tL:=LLV(L,nL);
for i=nL+1 to datacount do begin
   if fL[i] > tL[i]                                                   then  CBL[i]:=tL[i-1]
   else if fH[i-2] > fH[i-1] and fH[i-2] > fH[i]
       and fH[i-1] > fH[i]                                            then  CBL[i]:=fH[i-2]
   else if nL > 3 and fH[i-3] > fH[i-2] and fH[i-3] > fH[i-1]
       and fH[i-3] > fH[i] and (fH[i-2] > fH[i] or fH[i-1] > fH[i])   then  CBL[i]:=fH[i-3]
   else if nL > 4 and fH[i-4] > fH[i-3] and fH[i-4] > fH[i-2]
       and fH[i-4] > fH[i-1] and fH[i-4] > fH[i]
       and (fH[i-3] > fH[i] or fH[i-2] > fH[i] or fH[i-1] > fH[i])    then  CBL[i]:=fH[i-4]
   else if nL > 5 and fH[i-5] > fH[i-4] and fH[i-5] > fH[i-3]
       and fH[i-5] > fH[i-2] and fH[i-5] > fH[i-1]
       and fH[i-5] > fH[i]
       and (fH[i-4] > fH[i] or fH[i-3] > fH[i] or fH[i-2] > fH[i] or fH[i-1] > fH[i])  then  CBL[i]:=fH[i-4];
end;
CBL;

 

加几个分号就可以了