我在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 //结束循环
测试的时候报错 第八行 无法识别的算数表达式。
(1)判断一个变量是否为0,不是双=号,一个就够了,如 xiangbao=0
(2)你这里的xiangbao需要设置为全局变量,
详细请参考: http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=332 问题1