達(dá)到條件A 全部平掉,怎么表達(dá)呢? [金字塔]
- 咨詢內(nèi)容:
請(qǐng)問,后臺(tái) 達(dá)到條件A 就把該后臺(tái)模型(不是全部模型的)多頭倉位或者空頭倉位全部平掉,怎么表達(dá)呢?
- 金字塔客服:
這個(gè)倉位上是不會(huì)對(duì)應(yīng)哪個(gè)和哪個(gè)合約的,你要平掉持倉只能自己知道后臺(tái)進(jìn)過操作后,當(dāng)前會(huì)有多少倉,然后再平掉
- 用戶回復(fù):
就是要自己在前面定義變量,變量隨著交易變動(dòng),到最后平掉就根據(jù)這個(gè)變量來平,對(duì)吧?
- 網(wǎng)友回復(fù):
可以用全局變量來記錄下了多少手單,但是這個(gè)可能因?yàn)椴怀山换蛘叱穯沃惖膯栴}導(dǎo)致數(shù)值不正確,比如用這個(gè)方法
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是你開倉時(shí)的下單數(shù)量
最后平倉的手?jǐn)?shù)多是:extgbdata('duocang')
空倉:extgbdata('kongcang')
- 網(wǎng)友回復(fù): 非常感謝!
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 1145508240 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容