COCO研究院

 找回密碼
 註冊
搜索
查看: 3117|回復: 10

[教學] 請教出現array bounds wrong index value 處理方法

[複製鏈接]
發表於 20-10-26 20:29 | 顯示全部樓層 |閱讀模式
我抄別人的程式碼,抄完結果發現array bounds wrong index value,該怎樣解決,有朋友試過嗎??
發表於 20-10-27 15:30 | 顯示全部樓層
陣列錯誤
檢查陣列
 樓主| 發表於 20-10-27 20:32 | 顯示全部樓層
var: ID(-1),oo(0),windows_high(0),windows_low(0),direction(0),z(0);
arrays: high1[15000,2](0),low1[15000,2](0);

//recording the highand low
oo=oo+1;
high1[oo,0] = high;
high1[oo,1] = Time;
high1[oo,2] = Date;

low1[oo,0] = low;
low1[oo,1] = Time;
low1[oo,2] = Date;

//confirm high and low signal indicator
value1 = Average(high,20);
value2 = Average(low,20);

//plot the high and low chart
condition1 = close[1] > value2 and close < value2; //bear signal
condition2 = close[1] < value1 and close > value1; //bull signal

if condition1 then windows_high = 0;
if close > value1 then windows_high = windows_high+1; //calculate high windows for searching

if condition2 then windows_low = 0;
if close < value2 then windows_low = windows_low+1; //calculate low windows for searching

if windows_high = 0 and windows_high[1]<>0 then
value3 = highest(high,windows_high[1]); //find the highest price during the windows

if windows_low = 0 and windows_low[1]<>0 then
value4 = lowest(low,windows_low[1]); //find the lowest price during the windows

if windows_high = 0 and windows_high[1]<>0 then begin
        for z = oo-windows_high[1] to oo begin
                if high1[z,0]>value1 and high1[z,0] = value3 then begin
                        ID = text_new(high1[z,2],high1[z,1],high1[z,0], "HIGH");
                        text_setcolor(id,white);
                        break;
                end;
        end;
end;

if windows_low = 0 and windows_low[1]<>0 then begin
        for z = oo-windows_low[1] to oo begin
                if low1[z,0]<value2 and low1[z,0] = value4 then begin
                        ID = text_new(low1[z,2],low1[z,1],low1[z,0], "LOW");
                        text_setcolor(id,white);
                        break;
                end;
        end;
end;
 樓主| 發表於 20-10-27 20:35 | 顯示全部樓層
jason666 發表於 20-10-27 15:30
陣列錯誤
檢查陣列

附上程式碼了,能教教我怎麼改嗎?
發表於 20-10-29 22:40 | 顯示全部樓層
疑?我貼上去
----- 已成功編譯  ------

沒有錯阿,很眼熟,
我有看也有打,是 Better Trading 的高低點標註
發表於 20-10-29 22:45 | 顯示全部樓層
他給的是
Arrays: high1[150000,2](0), Low1[150000,2](0);

不過一樣
----- 已成功編譯  ------

我也不知道為何你會錯誤??
 樓主| 發表於 20-10-30 01:05 | 顯示全部樓層
jason666 發表於 20-10-29 22:45
他給的是
Arrays: high1[150000,2](0), Low1[150000,2](0);

對,better trading的,是成功編輯了,但是要在放上圖的時候出現這個字
發表於 20-10-30 20:44 | 顯示全部樓層
本帖最後由 jason666 於 20-10-30 21:22 編輯

我的是可以,你看看
我是新手,
也不知道你是那邊問題出現錯誤訊息

圖片

圖片

圖片

圖片
發表於 20-10-30 23:02 | 顯示全部樓層
我非人 發表於 20-10-30 01:05
對,better trading的,是成功編輯了,但是要在放上圖的時候出現這個字

arrays: high1[15000,2](0),low1[15000,2](0);

你的arrays只有15000個元素, 你的圖超過15000支bar, 放不下了,

改為 arrays: high1[150000,2](0),low1[150000,2](0);
或限制你的圖只看15000支bar

評分

參與人數 1金錢 +1 收起 理由
tinyding + 1  

查看全部評分

 樓主| 發表於 20-10-31 00:59 | 顯示全部樓層
SALLY 發表於 20-10-30 23:02
arrays: high1[15000,2](0),low1[15000,2](0);

你的arrays只有15000個元素, 你的圖超過15000支bar, 放不 ...

多謝前輩,真是一言驚醒夢中人啊,換成日線圖來看是成功了
發表於 20-11-1 11:40 | 顯示全部樓層
原來如此,有收穫,謝謝 SALLY
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-4-23 16:39

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook