/*** 在逐K线的模式下运行。做一个序列变量数组,按照道理在第一个数据已经被赋过值了,但是出现数据越界错误。请高手指点一下。
Variable: IPeak[]=0;
if BarPos=1 then IPeak[BarPos-1]:=5;
if BarPos>=2 then
begin
IPeak[BarPos-1]:= IPeak[BarPos-2]+1; //出现数据越界问题。
end
ShowIPeak:IPeak;
pe?l的数组是从1开始的,你开始运行时搞成0了当然要越界了
谢谢反馈。不过应该不是这个问题。下面这两句可以通过编译,结果也是对的。所以下标可以从0开始。
Variable: IPeak[]=0;
if BarPos=1 then IPeak[BarPos-1]:=5;
但是加上下面这句话,数组就越界了。
if BarPos=2 then IPeak[BarPos-1]:=6;
你可以试一下。
不行,不能从0开始,不要在坚持自己的想法了,根据金字塔的规则来
那个问题解决了。加上一行:IPeak:=close; 就好了。