腳本的問題

  •   111 
  • 最後發表   艾瑞克  2024 一月 15
艾瑞克 發文於   2024/01/12

 可以請小幫手幫我看一下腳本嗎?

回測的時候完全沒有交易,我看了很久,完全不知道到底哪裡出了問題,可以請小幫手幫我看一下嗎?

input:ratio(20,"月營收年增率下限"); 

value1=dateValue(currentdate,"d");

 

condition1=false;

condition2=false;

 

condition1=trueall(getfield("月營收年增率", "M")>0,2);

 

If V<>0 

and 100*Summation(getfield("關鍵券商買賣超張數", "D"),3)/Summation(V,3) >=10 

and Summation(getfield("關鍵券商買賣超張數", "D"),3) > 0 

then condition2=true;

 

if getfield("月營收年增率", "M")>=ratio

and barslast(getfield("月營收年增率", "M")>=ratio)[1]>12

and condition1

and condition2

then ret=1;

XS小編 發文於   2024/01/15

Hello 艾瑞克,

 

問題在 barslast(getfield("月營收年增率", "M")>=ratio)[1] 的部分,函數[1] 的撰寫方式會容易出錯。

建議您可以用變數保存再取用前期值,像是下面的 value1[1]:

value1 = barslast(getfield("月營收年增率", "M")>=ratio);

另外遇到問題時可以在腳本中加上 print 印出相關數值,會比較容易找出原因。

發表回覆
Close