序
上一篇 波段策略 跳空實作 Section 1 主策略 有單筆損失18萬及最大策略虧損77萬等不良紀錄。 今天先加入簡單的停損機制來改善虧損過大的問題。本策略進場訊號為開高長紅或開低長黑。所以,直接守紅黑K的高低點,再加一些緩衝。
加入停損後的回測績效比較
虧損報酬比從 3.18 拉升到 6.05 。不過勝率大幅降低,應該是常常觸動停損。
實作影片

前一篇未加停損的主訊號

前根K棒高低、停損程式碼
inputs: buffer(5); variables: stoploss(0); if entrytime = time and entrydate = date then begin if marketposition > 0 then stoploss = L[1] - buffer; if marketposition < 0 then stoploss = H[1] + buffer; end; if marketposition > 0 and close > stoploss then sell next bar at stoploss stop; if marketposition < 0 and close < stoploss then buytocover next bar at stoploss stop;
加入停損後的權益曲線



沒有留言:
張貼留言