manyung 發表於 21-1-20 23:10

導至記憶體不足的語法, 求修正

本帖最後由 manyung 於 21-1-20 23:19 編輯

inputs:
SD(0.5),atrloopend(14);


variables:   
dailyatr(0),atrupper(0),atrlower(0),atrbasic(0),sizing(0),atrloopval(0),atrsd(0);



Arrays:
dailyatrarray (0);



foratrloopval = 1 to atrloopend begin
      dailyatrarray = maxlist(HighD(atrloopval)-LowD(atrloopval),closeD(atrloopval+1)-LowD(atrloopval),HighD(atrloopval)-closeD(atrloopval+1));
end;
dailyatr= maxlist(HighD(2)-LowD(1),closeD(2)-LowD(1),HighD(1)-closeD(2));
atrbasic = AverageArray(dailyatrarray ,atrloopend);
atrsd= AvgDeviationArray(dailyatrarray ,atrloopend);
atrupper = atrbasic + atrsd*SD ;
atrlower = atrbasic - atrsd*SD ;

交易time flame 是30mins ,想取daily ATR 的值,會突然由10gb ram 增到64gb ram, 我猜是coding 中的loop 出問題, 試過用data2 來取日線圖數據
試過用每小時2支bar * 23交易小時 * 14天
頁: [1]
查看完整版本: 導至記憶體不足的語法, 求修正