提前開平倉(cāng)
作者:金字塔 來源:cxh99.com 發(fā)布時(shí)間:2016年07月22日
- 咨詢內(nèi)容:
如果想實(shí)現(xiàn)在每天最后一根k線提前4分鐘執(zhí)行開平倉(cāng),其余k線提前5秒執(zhí)行開平倉(cāng)代碼是不是可以這樣寫: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,手?jǐn)?shù),Market);end然后采用固定時(shí)間執(zhí)行,每4秒執(zhí)行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);
時(shí)間條件是
(abb1 or abb2)
- 用戶回復(fù):
我加上了上述條件,發(fā)現(xiàn)實(shí)際不下單了。當(dāng)前k線上也不出現(xiàn)賣出箭頭了,下一根k線出現(xiàn)后,上一根k線出現(xiàn)了賣出箭頭(也可能是下一根k線出現(xiàn)前幾秒出現(xiàn)的箭頭沒注意)。問題是實(shí)際沒有下單,看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,手?jǐn)?shù),Market);
end
請(qǐng)問會(huì)是什么原因
- 網(wǎng)友回復(fù):
tq=10,tq0=200固定間隔執(zhí)行策略,間隔時(shí)間是9秒我看了log在10:59:53執(zhí)行了策略,但沒有給下單指令2016-06-29 10:59:53.886 【圖表】150172 運(yùn)行完畢
- 網(wǎng)友回復(fù):
用的是走完k線下單還是固定時(shí)間間隔