Getfield主力成本在警示無法使用

  •   127 
  • 最後發表   superkennn  2024 六月 19
superkennn 發文於   2024/06/14

input:period(40,"主力成本線週期");

input:period_under(5,"價格在主力成本線下方的時間");

input:increase(5,"上漲%數");

value1=GetField("主力買張","日");

value2=(o+h+l+c)/4;

value3=value1*value2;//做多金額

 

if summation(value1,period)<>0

then value4=summation(value3,period)/summation(value1,period);

 

Print(file("D:\Print\"),"date=",date,"time=",time,"主力成本價",value4[1],"收盤價",close,"收盤上漲",(close-close[1])/close[1]);

 

if TrueAll(close[1] < value4[1], period_under)

and close > close[1]*(1+increase*0.01)

then ret=1;

 

以上是目前的code,希望符合以下條件後跳出警示

1. 前n天的收盤價皆低於主力成本價

2. 當前價格上漲超過m%

 

但開始執行後顯示 "計算停止,因為計算發生錯誤,請檢察腳本內的算式"

請問可能是甚麼問題呢

XS小編 發文於   2024/06/19

Hello superkennn,

 

GetField("主力買張","日") 是日以上頻率的資料,當日的資料會在盤後才更新,故沒辦法用在即時上。

應該要取前期值才是正確的執行方式 (當日盤中最多只會有昨日的資料)。

發表回覆
Close