以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请帮忙看看错在哪里  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=8308)

--  作者:nk1m
--  发布时间:2011/10/8 12:43:07
--  请帮忙看看错在哪里

 我在mt4中编了一下缠论分笔的公式,拿到金字塔来,改了一下格式,为什么通不过呢。把前一段公式的代码贴在下面。请朋友们帮忙看看,有啥问题。本人刚刚接触金字塔。

 

 Highxiu:=high;

 Lowxiu:=low;

 IF NOT(ISLASTBAR) THEN EXIT; //为了加快运算速度,只有最后一个周期时才循环计算

 for Shi=1 to datacount do

  begin

      if Shi>=1 and xiangbao==0 then

        begin         

          if (Highxiu[Shi]>Highxiu[Shi-1] and Lowxiu[Shi]>Lowxiu[Shi-1]) then xiangbao:=1;

          if (Highxiu[Shi]<Highxiu[Shi-1] and Lowxiu[Shi]<Lowxiu[Shi-1]) then  xiangbao:=-1;

        end

      if xiangbao==1 then

        begin

          if Highxiu[Shi]>=Highxiu[Shi-1] and Lowxiu[Shi]<Lowxiu[Shi-1] then 

           begin

             Lowxiu[Shi]:=Lowxiu[Shi-1];

           end

          if Highxiu[Shi]<Highxiu[Shi-1] and Lowxiu[Shi]>=Lowxiu[Shi-1] then

            begin

             Highxiu[Shi]:=Highxiu[Shi-1];

            end

          if Highxiu[Shi]<Highxiu[Shi-1] and Lowxiu[Shi]<Lowxiu[Shi-1] then

            begin

              xiangbao:=-1;

            end

         end

      if xiangbao==-1 then

        begin

          if Highxiu[Shi]>Highxiu[Shi-1] and Lowxiu[Shi]<=Lowxiu[Shi-1] then

            begin

             Highxiu[Shi]:=Highxiu[Shi-1];

            end

          if Highxiu[Shi]<=Highxiu[Shi-1] and Lowxiu[Shi]>Lowxiu[Shi-1] then

            begin

             Lowxiu[Shi]:=Lowxiu[Shi-1];

            end

          if Highxiu[Shi]>Highxiu[Shi-1] and Lowxiu[Shi]>Lowxiu[Shi-1] then

            begin

              xiangbao:=1;

            end

         end

   end         //结束循环

 

测试的时候报错  第八行 无法识别的算数表达式。

[此贴子已经被作者于2011-10-8 12:46:11编辑过]

--  作者:fly
--  发布时间:2011/10/8 13:41:08
--  

(1)判断一个变量是否为0,不是双=号,一个就够了,如   xiangbao=0

 

(2)你这里的xiangbao需要设置为全局变量,

详细请参考:  http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=332  问题1