關于多框架運行,持倉理論與實際倉位同步 [金字塔]
- 咨詢內容:
老師您好,我想在多框架運行程序,但是持倉同步選秀 只能單框架運行,我想在交易策略里面寫入,程序自動檢測,實際持倉與理論一致。
- 金字塔客服:
這個只能后臺程序化中做到
- 用戶回復:
標題應該是 實際持倉 與理論同步在程序里面寫入,程序走完一根K先,自動檢測,實際持倉與理論是否同步
- 網友回復:
//用全局變量,實現次周期恢復持倉功能,供參考
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//開倉信號消失,平倉恢復倉
begin
sell(tholding2>0,1,marketr);
sellshort(tholding2<0,1,marketr);
EXTGBDATASET( 'kai',0);
end
if barpos=EXTGBDATA('ping')+1 then//平倉信號消失,開倉恢復倉
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,信號消失一根K線上也只開一次倉
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這是之前老師寫的代碼,需要怎樣修改呢
實際持倉 與理論同步
在程序里面寫入,程序走完一根K先,自動檢測,實際持倉與理論是否同步
[此貼子已經被作者于2016-7-3 19:19:42編輯過] - 網友回復: 自動持倉同步參考系統自帶的功能
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容