提前開平倉
作者:金字塔 來源:cxh99.com 發布時間:2016年07月22日
- 咨詢內容:
如果想實現在每天最后一根k線提前4分鐘執行開平倉,其余k線提前5秒執行開平倉代碼是不是可以這樣寫:abb:=((time0-timetot0(dynainfo(207))<=5) and not(islastbar)) or (islastbar and (time0-timetot0(dynainfo(207))<=240));if abb then begin平多:SELL(平1 and 可平>0,可平,Market);開多:BUY(開1 AND 開 AND HOLDING<=0,手數,Market);end然后采用固定時間執行,每4秒執行1次
上面這樣寫是否有問題
- 金字塔客服:
abb1:=((time0-timetot0(dynainfo(207))<=5) or not(islastbar)) and time<>closetime(0);
abb2:=((time0-timetot0(dynainfo(207))<=240) or not(islastbar)) and time=closetime(0);
時間條件是
(abb1 or abb2)
- 用戶回復:
我加上了上述條件,發現實際不下單了。當前k線上也不出現賣出箭頭了,下一根k線出現后,上一根k線出現了賣出箭頭(也可能是下一根k線出現前幾秒出現的箭頭沒注意)。問題是實際沒有下單,看log中也沒有要求下單的指令。代碼如下:abb1:=((time0-timetot0(dynainfo(207))<=tq) or not(islastbar)) and time<>closetime(0);abb2:=((time0-timetot0(dynainfo(207))<=tq0) or not(islastbar)) and time=closetime(0);if (abb1 or abb2) then begin平多:SELL(平 and 可平>0,可平,Market);開多:BUY(開 AND HOLDING<=0,手數,Market);
end
請問會是什么原因
- 網友回復:
tq=10,tq0=200固定間隔執行策略,間隔時間是9秒我看了log在10:59:53執行了策略,但沒有給下單指令2016-06-29 10:59:53.886 【圖表】150172 運行完畢
- 網友回復:
用的是走完k線下單還是固定時間間隔