編譯後沒跳出標的

  •   51 
  • 最後發表   w w  2024 一月 19
w w 發文於   2024/01/17

小編您好:

我寫個盤中警示可編譯但跳出標的不正確...可以請您幫忙看一下哪需要修正嗎?

紀錄090000~093000的最低點,過指定時間後,今日低點小於紀錄低點  ,成交價大於第一根均價, 警示

  

if  barfreq <> "Min"  or barinterval <> 2 then  raiseruntimeerror("腳本只適合用於2分鐘");

 

variable:_low(9999);   

 

input:_time  (093000) ;

 

if date <> date[1] then begin

   Value1 = GetQuote("均價");   end; 

   //第一根均價

 

 

if currentdate <> date then return;

      // (日期與系統一致)

  

if time > 090000  and time < _time  and low < _low then _low =  low ;

 // 090000後未過指定時間如果low<_low則_low再重新記錄低

 

 

if  getfield("low","D")  <  _low  and   time > _time  and  close > value1  

 

  //過指定時間後今日低點小於紀錄低點  成交價大於第一根均價

  

 

then ret=1;

 

XS小編 發文於   2024/01/19

 Hello w w,

 

網站上有教學區,裡面有XS語法的基礎和應用可以閱覽。

 

您可以在腳本中加上print印出相關數值,會比較好找出問題原因,舉例來說:

if  getfield("low","D")  <  _low  and   time > _time  and  close > value1 then begin 

    ret=1;

    print(date, time, _low, getfield("Low", "D"), value1, close);

    end;

且均價有資料欄位,建議可以改用資料欄位 (可用在回測),會比報價欄位方便。

如果還是有問題的話,麻煩告知有誤的商品和觸發日期,小編確認看是什麼原因導致觸發。

 

發表回覆
Close