k線結(jié)束前執(zhí)行
作者:金字塔 來(lái)源:cxh99.com 發(fā)布時(shí)間:2016年07月13日
- 咨詢內(nèi)容:
看了阿火的帖子,
abb:=(time0-timetot0(dynainfo(207))<=5) 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這個(gè)條件覺(jué)得不太對(duì),
這段代碼開(kāi)平倉(cāng)執(zhí)行的時(shí)機(jī)是:如果當(dāng)前k線是當(dāng)天最后一根k線并且在收盤前5秒,或者當(dāng)前k線不是最后一根k線,下面的開(kāi)平倉(cāng)就會(huì)被固定時(shí)間去執(zhí)行
- 金字塔客服:
如果想要實(shí)現(xiàn),在每根k線都提前5秒執(zhí)行不應(yīng)該用上述條件吧
- 用戶回復(fù):
是這個(gè)abb的條件和開(kāi)平倉(cāng)條件滿足就會(huì)提前5秒下單
- 網(wǎng)友回復(fù):
abb:=(time0-timetot0(dynainfo(207))<=5) or not(islastbar);
只要islastbar=0, abb就會(huì)等于1,而islastbar=0不就是說(shuō)當(dāng)前的k線不是最后一根k線嗎
也就是說(shuō)只要當(dāng)前不是最后一根k線開(kāi)平倉(cāng)的判斷與執(zhí)行就會(huì)在每次固定間隔時(shí)間去執(zhí)行,而不是k線的最后5秒。我上面的理解有什么問(wèn)題嗎
- 網(wǎng)友回復(fù):
不是的
not(islastbar)是保留歷史信號(hào)用的,
(time0-timetot0(dynainfo(207))<=5)是判斷當(dāng)前k離走完k線是否<=5秒