欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 数组下标越界问题

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有5814人关注过本帖树形打印复制链接

主题:数组下标越界问题

美女呀,离线,留言给我吧!
hjl
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:2 积分:6 威望:0 精华:0 注册:2011/7/9 10:48:29
数组下标越界问题  发帖心情 Post By:2011/7/20 13:26:06    Post IP:113.65.131.85[只看该作者]

代码:


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;

编译通过,插入图表时显示数组下标越界。呵呵,高手帮帮忙,看看怎么改


 回到顶部
帅哥哟,离线,有人找我吗?
jinzhe
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
[求助]请老师改成金字塔格式的  发帖心情 Post By:2011/7/20 13:43:36    Post IP:58.246.57.26[只看该作者]


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

我把数组的前4赋值,以及把else的意思用if给表示了出来


金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
帅哥哟,离线,有人找我吗?
26327756l
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:黑侠 帖子:676 积分:2548 威望:0 精华:3 注册:2011/4/13 16:18:50
  发帖心情 Post By:2011/7/20 14:24:41    Post IP:58.246.57.26[只看该作者]


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;


 回到顶部
美女呀,离线,留言给我吧!
hjl
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:2 积分:6 威望:0 精华:0 注册:2011/7/9 10:48:29
  发帖心情 Post By:2011/7/20 16:08:42    Post IP:113.65.131.85[只看该作者]

呵呵,谢谢呀

 回到顶部