代码:
tj2:=0;
tj3:=0;
for i=1 to datacount do
begin
q2h[i]:=ref(high,2);
q2l[i]:=ref(low,2);
if ref(high,2)>=ref(high,3) and ref(high,2)>=ref(high,4) and ref(high,2)>=ref(high,1) and ref(high,2)>=high and i>=5 then gw[i]:=q2h[i];
else gw[i]:=gw[i-1];
if ref(low,2)<=ref(low,3) and ref(low,2)<=ref(low,4) and ref(low,2)<=ref(low,1) and ref(low,2)<=low and i>=5 then dw[i]:=q2l[i];
else dw[i]:=dw[i-1];
end
gg:gw;
dd:dw;
编译通过,插入图表时显示数组下标越界。呵呵,高手帮帮忙,看看怎么改
for i=1 to datacount do
begin
q2h[i]:ref(high,2);
q2l[i]:ref(low,2);
dw[1]:=1;gw[1]:=1;
dw[2]:=1;gw[2]:=1;
dw[3]:=1;gw[3]:=1;
dw[4]:=1;gw[4]:=1;
if ref(high,2)>=ref(high,3) and ref(high,2)>=ref(high,4) and ref(high,2)>=ref(high,1) and ref(high,2)>=high and i>=5 then gw[i]:=q2h[i];
if ref(high,2)<ref(high,3) and ref(high,2)<ref(high,4) and ref(high,2)<ref(high,1) and ref(high,2)<high and i>=5 then gw[i]:=gw[i-1];
if ref(low,2)<=ref(low,3) and ref(low,2)<=ref(low,4) and ref(low,2)<=ref(low,1) and ref(low,2)<=low and i>=5 then dw[i]:=q2l[i];
if ref(low,2)>ref(low,3) and ref(low,2)>ref(low,4) and ref(low,2)>ref(low,1) and ref(low,2)>low and i>=5 then dw[i]:=dw[i-1];
dd:dw;
gg:gw;
end
variable:a=0,b=0;
a=ref(high,2);b=ref(low,2);
tj2:=0;
tj3:=0;
for i=1 to datacount do
begin
q2h[i]:=ref(high,2);
q2l[i]:=ref(low,2);
if ref(high,2)>=ref(high,3) and ref(high,2)>=ref(high,4) and ref(high,2)>=ref(high,1) and ref(high,2)>=high and i>=5 then
begin
gw[i]:=q2h[i]; a=q2h[i];
end
else
gw[i]:=a;
if ref(low,2)<=ref(low,3) and ref(low,2)<=ref(low,4) and ref(low,2)<=ref(low,1) and ref(low,2)<=low and i>=5 then
begin
dw[i]:=q2l[i];b=q2l[i];
end
else
dw[i]:=b;
end
gg:gw;
dd:dw;