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