googleandy 發表於 13-2-16 13:12

請問bug在那裡?

本帖最後由 googleandy 於 13-2-16 13:28 編輯

我想在日K連4紅(黑)搶反彈, 在第5天做當沖(用5K).可是發現第6天系統又"額外"自動當沖一次,不知bug 在那裡? thanks.

程式碼如下:if   closeD(1)>openD(1) andcloseD(2)>openD(2) and closeD(3)>openD(3) and closeD(4)>openD(4)then begin   sellshort ("Short") next bar at market; End;
if   closeD(1)<openD(1) and closeD(2)<openD(2) and closeD(3)<openD(3) and closeD(4)<openD(4)then begin    Buy ("Long") next bar at market; End;
setexitonclose;
(sorry, 兩個圖片完全相同, 不知要如何移除其中一個)

bacardi 發表於 13-2-16 14:04

因為尾盤出場後,進場條件馬上又觸發,所以尾盤又進場, Andy大因為都開盤進場, 何不限定只能開盤15分鐘內進場試試看
if time < 0900 and closeD(1)>openD(1) andcloseD(2)>openD(2) and closeD(3)>openD(3) and closeD(4)>openD(4)then begin   sellshort ("Short") next bar at market;End;
if   time < 0900 and closeD(1)<openD(1) and closeD(2)<openD(2) and closeD(3)<openD(3) and closeD(4)<openD(4)then begin    Buy ("Long") next bar at market;End;
setexitonclose;

googleandy 發表於 13-2-16 14:49

bacardi 發表於 13-2-16 14:04 static/image/common/back.gif
因為尾盤出場後,進場條件馬上又觸發,所以尾盤又進場, Andy大因為都開盤進場, 何不限定只能開盤15分鐘內進場 ...

果然是 "出場後,進場條件馬上又觸發" 所致. thanks.
頁: [1]
查看完整版本: 請問bug在那裡?