小幫手您好,我在設定自動交易時腳本如下,指定選股是選股法,策略部位依庫存,開啟庫存異動時自動加入執行,在安控上也有勾選每日最多進場一次,但在啟動自動交易後,他還是會一直重複進出場,再請協助解惑,謝謝。
input:
maxprice(300,"股價不可超過"),
lostex(10,"虧損多少出場%"),
dayexit(3, "多少天出場");
var:
intraBarPersist dayentry(0); // 控制當天出場後,不會當天又再進場
if date <> date[1] and currenttime = 090000 then
dayentry = 0;
if date <> date[1] and position = 0 and dayentry = 0 and close <= maxprice then
setposition(1);
if position > 0 and filled > 0 and (
currenttime >= 090200 and date[dayexit - 3] > FilledRecordDate(FilledRecordCount) or
close <= filledAvgPrice * (1 - lostex * 0.01)
) then
setposition(0);
22 評論