【MC8.5】同一個出場語句可分批出場 [MC]
- 咨詢內容:
本帖最后由 MC_Winnie 于 2013-10-11 16:21 編輯
同一個出場語句可分批出場
MC8.5新增語法,允許在一個進場后,一行出場語句在多次滿足條件時,分多次出場。
關鍵字:
SameExitFromOneEntryOnce
說明:
允許或禁止信號腳本,使用一行出場語句,從相同的進場執行多次分批出場。
用法:
[SameExitFromOneEntryOnce = LogicalValue]
參數:
LogicalValue —— True = 禁止分批出場;False = 允許分批出場。
注意:
在策略運行時,改變參數,不能編譯。
舉例:
若進場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技術部: 學習了
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容