達到條件A 全部平掉,怎么表達呢? [金字塔]
- 咨詢內容:
請問,后臺 達到條件A 就把該后臺模型(不是全部模型的)多頭倉位或者空頭倉位全部平掉,怎么表達呢?
- 金字塔客服:
這個倉位上是不會對應哪個和哪個合約的,你要平掉持倉只能自己知道后臺進過操作后,當前會有多少倉,然后再平掉
- 用戶回復:
就是要自己在前面定義變量,變量隨著交易變動,到最后平掉就根據這個變量來平,對吧?
- 網友回復:
可以用全局變量來記錄下了多少手單,但是這個可能因為不成交或者撤單之類的問題導致數值不正確,比如用這個方法
if 開多條件 and 持倉判斷 then begin
tbuy........;
extgbdataset('duocang',extgbdata(duocang)+n);
end
if 開空條件 and 持倉判斷 then begin
tbuyshort........;
extgbdataset('kongcang',extgbdata(kongcang)+n);
end
if 平多條件 and 持倉判斷 then begin
tsell........;
extgbdataset('duocang',extgbdata(duocang)-n);
end
if 平空條件 and 持倉判斷 then begin
tbuyshort........;
extgbdataset('kongcang',extgbdata(kongcang)-n);
end
if time=closetime(0) then begin
extgbdataset('duocang',0);
extgbdataset('kongcang',0);
end
n是你開倉時的下單數量
最后平倉的手數多是:extgbdata('duocang')
空倉:extgbdata('kongcang')
- 網友回復: 非常感謝!
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容