關(guān)于多框架運(yùn)行,持倉(cāng)理論與實(shí)際倉(cāng)位同步 [金字塔]
- 咨詢(xún)內(nèi)容:
老師您好,我想在多框架運(yùn)行程序,但是持倉(cāng)同步選秀 只能單框架運(yùn)行,我想在交易策略里面寫(xiě)入,程序自動(dòng)檢測(cè),實(shí)際持倉(cāng)與理論一致。
- 金字塔客服:
這個(gè)只能后臺(tái)程序化中做到
- 用戶(hù)回復(fù):
標(biāo)題應(yīng)該是 實(shí)際持倉(cāng) 與理論同步在程序里面寫(xiě)入,程序走完一根K先,自動(dòng)檢測(cè),實(shí)際持倉(cāng)與理論是否同步
- 網(wǎng)友回復(fù):
//用全局變量,實(shí)現(xiàn)次周期恢復(fù)持倉(cāng)功能,供參考
buycond:=ref(count(c>o,2)=2,1);
sellcond:=ref(count(c<o,2)=2,1);if holding>0 and sellcond and not(islastbar) then sell(1,1,marketr);
if holding<0 and buycond and not(islastbar) then sellshort(1,1,marketr);if buycond and holding=0 and not(islastbar) then
begin
buy(1,1,marketr);
end
if holding=0 and sellcond and not(islastbar) then buyshort(1,1,marketr);
if islastbar and tholding2<>holding then
begin
if barpos=EXTGBDATA('kai')+1 then//開(kāi)倉(cāng)信號(hào)消失,平倉(cāng)恢復(fù)倉(cāng)
begin
sell(tholding2>0,1,marketr);
sellshort(tholding2<0,1,marketr);
EXTGBDATASET( 'kai',0);
end
if barpos=EXTGBDATA('ping')+1 then//平倉(cāng)信號(hào)消失,開(kāi)倉(cāng)恢復(fù)倉(cāng)
begin
buy(holding>0,1,marketr);
buyshort(holding<0,1,marketr);
EXTGBDATASET( 'ping',0);
end
endif holding>0 and sellcond and islastbar then
begin
sell(1,1,marketr);
EXTGBDATASET( 'ping',BARPOS);
endif holding<0 and buycond and islastbar then
begin
sellshort(1,1,marketr);
EXTGBDATASET( 'ping',BARPOS);
end
//全局變量BAR,信號(hào)消失一根K線上也只開(kāi)一次倉(cāng)
if ISLASTBAR AND buycond and barpos>EXTGBDATA('kai') and holding=0 then
begin
buy(1,1,marketr);
EXTGBDATASET( 'kai',BARPOS);
endif ISLASTBAR AND sellcond and barpos>EXTGBDATA('kai') and holding=0 then
begin
buyshort(1,1,marketr);
EXTGBDATASET( 'kai',BARPOS);
end這是之前老師寫(xiě)的代碼,需要怎樣修改呢
實(shí)際持倉(cāng) 與理論同步
在程序里面寫(xiě)入,程序走完一根K先,自動(dòng)檢測(cè),實(shí)際持倉(cāng)與理論是否同步
[此貼子已經(jīng)被作者于2016-7-3 19:19:42編輯過(guò)] - 網(wǎng)友回復(fù): 自動(dòng)持倉(cāng)同步參考系統(tǒng)自帶的功能
有思路,想編寫(xiě)各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫(xiě)!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容