關(guān)于后臺(tái)持倉(cāng)同步
作者:金字塔 來(lái)源:cxh99.com 發(fā)布時(shí)間:2021年11月01日
-
咨詢內(nèi)容:
請(qǐng)教:以下代碼,是阿火的后臺(tái)持倉(cāng)同步模版,前5行是否并不是后臺(tái)用的模版?只是一個(gè)圖表的開倉(cāng)程序?
然后,程序中是指定賬戶下單,如何改成所有賬戶都能下單(用于機(jī)構(gòu)版多賬戶)
cc:=holding;
if holding>0 and c<ref(c,1) then sell(1,1,market);
if holding<0 and c>ref(c,1) then sellshort(1,1,market);
if holding=0 and c>ref(c,1) then buy(1,1,market);
if holding=0 and c<ref(c,1) then buyshort(1,1,market);
if not(islastbar) or workmode<>1 then exit;
tm:=30;//撤單時(shí)間
ac:='800988';//下單賬戶
wt:=tremainqty(0,ac,stklabel);
buyhold:=tbuyholdingex(ac,stklabel,1);
sellhold:=tsellholdingex(ac,stklabel,1);
if wt>0.5 and tsubmit(0)>tm then tcancelex(1,0,ac,stklabel);//如果用軟件自帶的撤單功能,這句刪除。
if wt<0.5 then begin
?kc1:=max(cc,0)-buyhold;
?kc2:=abs(min(cc,0))-sellhold;
?if kc1<-0.5 then tsell(1,abs(kc1),mkt,0,0,ac),allowrepeat;
?if kc2<-0.5 then tsellshort(1,abs(kc2),mkt,0,0,ac),allowrepeat;
?if sellhold<0.5 and kc1>0.5 then tbuy(1,kc1,mkt,0,0,ac),allowrepeat;
?if buyhold<0.5? and kc2>0.5 then tbuyshort(1,kc2,mkt,0,0,ac),allowrepeat;
end
?
-
金字塔客服:
?1.是的。前面部分其實(shí)是圖表的代碼。2.多賬號(hào)可以 用多賬號(hào)組的方式去下單。這樣就會(huì)對(duì)所有賬號(hào)組下面的賬號(hào)下單。進(jìn)入多賬號(hào)設(shè)置里面把多個(gè)賬號(hào)設(shè)成一個(gè)組管理就可以了。 你下單語(yǔ)句里面的參數(shù)填寫賬號(hào)組的名稱就行了。
此主題相關(guān)圖片如下:temp.png
?
?來(lái)源:程序化久久網(wǎng)( www.weiqiv.net.cn )
-
用戶回復(fù):
關(guān)于2,因?yàn)楹笈_(tái)程序里的語(yǔ)句是指定賬戶的,比如:ac:='800988';//下單賬戶
wt:=tremainqty(0,ac,stklabel);這些語(yǔ)句怎么改成所有賬戶的?我試著把第二句改成 wt:=tremainqty(0,stklabel);好像是報(bào)錯(cuò)!
?
-
網(wǎng)友回復(fù):
?
//ac:='800988';//下單賬戶
wt:=tremainqty(0,'',stklabel);
?
?
您蹦到的報(bào)錯(cuò)信息,都是語(yǔ)法錯(cuò)誤,建議你自己針對(duì)錯(cuò)誤,查看相關(guān)的函數(shù)說(shuō)明
[此貼子已經(jīng)被作者于2020/9/14 10:57:48編輯過(guò)]