到奇狐勝券首頁 奇狐社區論壇 購買奇狐勝券 試用奇狐勝券
 
論壇首頁 你可以在這裡編輯你的資料,查看短訊,訂閱主題和論壇參數等等 免費會員註冊 會員列表 論壇幫助 論壇日曆 論壇搜索 加入我的最愛 登出論壇  
奇狐社區論壇 : Powered by vBulletin version 2.3.0 奇狐社區論壇 > 指標公式 > 問題交流 > [求救]換成5.2, 公式出現BUG- 指標越界或超出有效區間
  上一主題   下一主題
作者
主題 發表新主題    回覆主題
亞當理論
初級會員

註冊日期: Jul 2005
來  自:
文章數量: 19

[求救]換成5.2, 公式出現BUG- 指標越界或超出有效區間

Any one could help:

cc:=CLOSE;
oo:=OPEN;
hh:=HIGH;
ll:=LOW;
top:=HIGH;
bot:=LOW;
xx[1]:=1;
kk:=1;
for i=1 to DATACOUNT do begin IF xx[i]=1 then begin top[i]:=hh[i];
end;
IF xx[i-1]=1 then begin IF hh[i]>top[i-1] then begin top[i]:=hh[i];
xx[i]:=1;
end;
else begin top[i]:=top[i-1];
xx[i]:=2;
end;
end;
IF xx[i-1]=2 then begin IF hh[i]>top[i-1] then begin top[i]:=hh[i];
xx[i]:=1;
end;
else begin top[i]:=top[i-1];
bot[i]:=ll[i];
xx[i]:=3;
end;
end;
IF xx[i-1]=3 then begin top[i]:=top[i-1];
IF ll[i]<bot[i-1] then begin bot[i]:=ll[i];
xx[i]:=3;
end;
else begin bot[i]:=bot[i-1];
xx[i]:=4;
end;
end;
IF xx[i-1]=4 then begin top[i]:=top[i-1];
IF ll[i]<bot[i-1] then begin bot[i]:=ll[i];
xx[i]:=3;
end;
else begin bot[i]:=bot[i-1];
xx[i]:=5;
end;
end;
IF xx[i-1]=5 then begin IF ll[i]<bot[i-1] or hh[i]>top[i-1] then begin top[i]:=hh[i];
bot[i]:=hh[i];
xx[i]:=1;
end;
else begin bot[i]:=bot[i-1];
top[i]:=top[i-1];
xx[i]:=5;
end;
end;
end;
for j=1 to DATACOUNT do begin IF xx[j]=5 and xx[j-1]=4 then begin for k=j-1 downto j-kk do begin top[k]:=top[j];
bot[k]:=bot[j];
end;
end;
IF xx[j-1]=5 and xx[j]=1 then kk:=0;
kk:=kk+1;
end;

亞當理論 附帶上了此圖片:

向版主報告此篇 | 查IP位址
Old Post 2020-09-05 22:26
亞當理論 現在離線 點選這裡查看 亞當理論 的個人資料 點選這裡給 亞當理論 傳送一條短訊 查找更多關於 亞當理論 的文章 增加 亞當理論 至你的好友列表 編輯/刪除訊息 引用回覆
cgjj
總版主

註冊日期: Oct 2003
來  自:
文章數量: 18091

回覆: [求救]換成5.2, 公式出現BUG- 指標越界或超出有效區間

引用:
最初由 亞當理論 發表
Any one could help:

cc:=CLOSE;
oo:=OPEN;
hh:=HIGH;
ll:=LOW;
top:=HIGH;
bot:=LOW;
xx[1]:=1;
kk:=1;
for i=1 to DATACOUNT do begin IF xx[i]=1 then begin top[i]:=hh[i];
end;
IF xx[i-1]=1 then begin IF hh[i]>top[i-1] then begin top[i]:=hh[i];
xx[i]:=1;
end;
else begin top[i]:=top[i-1];
xx[i]:=2;
end;
end;
IF xx[i-1]=2 then begin IF hh[i]>top[i-1] then begin top[i]:=hh[i];
xx[i]:=1;
end;
else begin top[i]:=top[i-1];
bot[i]:=ll[i];
xx[i]:=3;
end;
end;
IF xx[i-1]=3 then begin top[i]:=top[i-1];
IF ll[i]<bot[i-1] then begin bot[i]:=ll[i];
xx[i]:=3;
end;
else begin bot[i]:=bot[i-1];
xx[i]:=4;
end;
end;
IF xx[i-1]=4 then begin top[i]:=top[i-1];
IF ll[i]<bot[i-1] then begin bot[i]:=ll[i];
xx[i]:=3;
end;
else begin bot[i]:=bot[i-1];
xx[i]:=5;
end;
end;
IF xx[i-1]=5 then begin IF ll[i]<bot[i-1] or hh[i]>top[i-1] then begin top[i]:=hh[i];
bot[i]:=hh[i];
xx[i]:=1;
end;
else begin bot[i]:=bot[i-1];
top[i]:=top[i-1];
xx[i]:=5;
end;
end;
end;
for j=1 to DATACOUNT do begin IF xx[j]=5 and xx[j-1]=4 then begin for k=j-1 downto j-kk do begin top[k]:=top[j];
bot[k]:=bot[j];
end;
end;
IF xx[j-1]=5 and xx[j]=1 then kk:=0;
kk:=kk+1;
end;



公式本身就撰寫有誤,奇狐 v5.2 只是檢查的比較嚴格而已,防止越界!

奇狐的數列是自1數起,不是從零數起
故不存在第零個元素,也就是不存在 n[0]

你的兩個迴圈 i 和 j ,都是自1開始遞增
當 i-1 或 j-1 時,會發生 1-1=0 的情況
故會被警告越界!!!
改從2開始遞增就可解決問題

向版主報告此篇 | 查IP位址
Old Post 2020-09-05 23:39
cgjj 現在離線 點選這裡查看 cgjj 的個人資料 點選這裡給 cgjj 傳送一條短訊 查找更多關於 cgjj 的文章 增加 cgjj 至你的好友列表 編輯/刪除訊息 引用回覆
全部時間均為台灣時間, 現在時間為05:05 發表新主題    回覆主題
  上一主題   下一主題
顯示可列印版本 | 訂閱此主題

論壇跳轉:
主題評分:

論壇規定:
你不可以發表新主題
你不可以回覆文章
你不可以上傳附件
你不可以編輯自己的文章
HTML語法禁止
vB 語法核准
表情符號核准
貼圖語法[IMG]核准
 

本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。

Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.

簡愛洋行 製作 Copyright 2003-. All Rights Reserved.  聯絡我們