在相同的策略裡面,一般來說就是單筆進場單筆出場,buy 對應的是sell,sellshort對應的是buytocover;進階功能可以分成單筆進分批出,或者是分批進單筆出,在Multicharts裡面可以直接控制
if condition1 then buy next bar at market; 如果在策略屬性裡面的部位限制放寬同時可以N口同向部位存在
此時在圖表上面如果有出現相同條件的訊號就會不斷產生買進或賣出訊號,直到最大容許的口數達到上限
如果改成不同條件分批進場
if condition1 then buy(“B1”) next bar at market;
if condition2 then buy(“B2”) next bar at market;
if condition3 then buy(“B3”) next bar at market;
在策略屬性裡面就要設定 排除相同訊號產生委託
控制分批出場開關:SameExitFromOneEntryOnce
[SameExitFromOneEntryOnce = false];
if condition1 then buy 3 shares next bar at market;
if condition2 then sell 1 Contracts next bar at market
加入setstopcontract指令,策略出場變個別獨立
也可以針對特定進場條件指定分批出場
if condition1 then buy ("B1") next bar at market;
if condition2 then buy ("B2") next bar at market;
if condition3 then buy ("B3") next bar at market;
if ...... then begin
sell from entry("B1") next bar at market;
sell from entry("B2") next bar at market;
sell from entry("B3") next bar at market;
end;
透過多口數調整 這樣交易策略就會變得特別有趣,不管是相同訊號產生委託分批進場,或是獨立不同條件分批進場,在資金的分配與口數的管理又更增添變化;到底應該分批進場一起出場好,還是一起進場分批出場好? 交易策略有更多的變化,績效也許就有更多突破性的成長
以上心得分享 歡迎留言討論。 或是追蹤我的 FB粉絲頁 https://www.facebook.com/upup12341234