Translate

2013年7月12日 星期五

使用Cross Under and Cross Over需注意的事 !

程式在撰寫比較條件式時,大多數都會使用 Cross Under (向下穿越),或
Cross Over (向上穿越) 來配合,而不使用 > 或 <  ,為什麼呢 ? 其實這就看個人見解及使用方式囉 !
不過在使用Cross Under  或 Cross Over 時需要注意一點,在台灣的期貨市場中,容易常有巨量跳空出現,然而在此情狀發生時 Cross Under 或 Cross Over 就會出現很大的問題出現.
使用RSI 當範例 :
當條件式rsi cross under 50 放空一口,當rsi cross over 70 時停損出場


If RSI (Close,14) Cross Under 50 Then
Sell("sell") Next Bar on Market
End If
If MarketPosition=-1 And RSI (Close,14) Cross Over 70 Then
Exithort("Exit") Next Bar ON Market
End If

乍看之下 因該沒有問題 實際用上後也沒問題 ,但當開盤往上跳空到70以上後 ,就完全不會有反應了,只好等著被嘎上去了 !

為了防範這些情況發生, 則必須再加上一些時間上的條件囉 !
例如 :
If Time =85000 And  RSI (Close,14) >70  Then
Exithort("TExit") Next Bar ON Market
End If

此時大於> 或<小於 就派上用場囉 !


Posted by Picasa

沒有留言:

張貼留言