走完k提前下單需要在代碼里怎么寫(xiě)才能實(shí)現(xiàn)
作者:金字塔 來(lái)源:cxh99.com 發(fā)布時(shí)間:2021年01月04日
-
咨詢內(nèi)容:
請(qǐng)教:這個(gè)功能,需要在代碼里怎么寫(xiě)才能實(shí)現(xiàn),
我的代碼是這樣的,提前3秒下單,成功了,然后K線走完,又重復(fù)下了一次
此主題相關(guān)圖片如下:1.png
此主題相關(guān)圖片如下:2.png
?
-
金字塔客服:
?1.重復(fù)下單了?這個(gè)K是不是當(dāng)天的第一個(gè)K啊。然后昨天最后一個(gè)K是不是有信號(hào)?如果是這種情況可能是勾選了“啟動(dòng)時(shí)重復(fù)交易檢測(cè)”導(dǎo)致的。
2.也有代碼實(shí)現(xiàn)的。但是需要用固定輪詢模式。有個(gè)范例:
ma5:=ma(c,5);
ma10:=ma(c,10);
input:tq(5,3,60,1);
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);
if abb then begin
? if holding>0 and ma5<ma10 then sell(1,1,thisclose);
? if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
? if holding=0 and ma5>ma10 then buy(1,1,thisclose);
? if holding=0 and ma5<ma10 then buyshort(1,1,thisclose);
end
[此貼子已經(jīng)被作者于2020/7/10 10:10:20編輯過(guò)]