【MC8.5】同一個出場語句可分批出場 [MC]
- 咨詢內(nèi)容:
本帖最后由 MC_Winnie 于 2013-10-11 16:21 編輯
同一個出場語句可分批出場
MC8.5新增語法,允許在一個進(jìn)場后,一行出場語句在多次滿足條件時,分多次出場。
關(guān)鍵字:
SameExitFromOneEntryOnce
說明:
允許或禁止信號腳本,使用一行出場語句,從相同的進(jìn)場執(zhí)行多次分批出場。
用法:
[SameExitFromOneEntryOnce = LogicalValue]
參數(shù):
LogicalValue —— True = 禁止分批出場;False = 允許分批出場。
注意:
在策略運(yùn)行時,改變參數(shù),不能編譯。
舉例:
若進(jìn)場15手,分3次出場時,可以使用如下兩種代碼中的一種:
1)寫3個相同的出場語句- sellshort 15 contracts next bar at market;
- if marketposition<>0 then begin
- if (time = 1000) then buytocover (\"BC1\") 5 contracts next bar at entryprice-10 stop;
- if (time = 1001) then buytocover (\"BC2\") 5 contracts next bar at entryprice-10 stop;
- if (time = 1002) then buytocover (\"BC3\") 5 contracts next bar at entryprice-10 stop;
- end;
~此方法減少了代碼的冗余,增加閱讀性~- sellshort 15 contracts next bar at market;
- [SameExitFromOneEntryOnce = false]
- if marketposition<>0 then
- if (time = 1000) then buytocover (\"BC1\") 5 contracts next bar at entryprice-10 stop;
- sellshort 15 contracts next bar at market;
- MC技術(shù)部: 學(xué)習(xí)了
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 1145508240 進(jìn)行 有償 編寫!(不貴!點擊查看價格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容