var:long_condition(false);
var:down2(0);
// 資料讀取筆數設定
down2 = average(close,10)[1];
if getfield("Time", "1") >= 092000 and filled=0 then begin
if getfield("Time", "1") >= 093100 and close>open[0] and open<close[1]*1.09 then setposition(FLoor(91/close[1]),market);
if getfield("Time", "1") >= 131000 and close>down2 then setposition(FLoor(91/close[1]),market);
if getfield("Time", "1") >= 093100 and close>close[1]*1.09 and open>close[1]*1.09 then setposition(FLoor(91/close[1]));
end;
if filled>0 then begin
if close <down2 or close<filledAvgPrice*0.9 then begin
setposition(0);
end;
end;
以上是我的自動交易程式,但有些小問題如圖,會在8:59的時候打單進去,但我很明確是要9:30之後才參考要不要進場
想請問要如何才能改善這問題呢?備註:之前用實單打出現這個bug然後用了兩層getfield("Time", "1") 模擬單測試發現仍會有這bug,但會這回測都能成功在9:30後才進入
所以我目前想到的修改方式1.頻率用分K去跑,但在取得日縣級別均線數據方面要做修改我不太懂怎麼做
2.頻率用日線跑,用getfield拿到日期不等於前一天的濾網做,不確定有沒有用
想請問小編或大神想法
1 評論