特定時間觸發進場

  •   226 
  • 最後發表   阿杜  2023 九月 26
阿杜 發文於   2023/09/12

您好:

請教自動交易在指定時間10:00內觸發condition1進場,我想再加上如果09:05分以前有觸發到的各股,今日就不要進場。

--------------------------------------------------------

condition1 = time < 100000

and closeD(0)>closeD(1)*kkk  

 

and value6 > 50000  

and close < BBB and close >= AAA  

 

 

and trueany(high>=low*CCC and C > O ,30)   ;  

XQ小幫手 發文於   2023/09/26

Hello, 阿杜.

您可以參考以下的腳本範例

 

var: intrabarpersist _date(0), intrabarpersist _cond(0);

if _date <> date then begin     //換日時或第一次執行時重置參數
    _date = date;
    _cond = 0;
    end;

condition1 = 您的觸發條件;

if currenttime < 090500 and condition1 then _cond = 1
else if currenttime < 100000 and _cond = 0 and condition1 and position = 0 and filled = 0 then setposition(1, market);

若您有使用逐筆洗價,應使用intrabarpersist這個函式。

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

 

https://www.xq.com.tw/learn

謝謝。

發表回覆
Close