From: TSTS星人

bollinger band的逆勢系統,bollinger band的主要構成為,均線及均線加減2倍標準差以後,所形成的上下通道。在統計上,超過2倍標差,代表價格偏離均線過大,如果一個具有均數回歸特性的期貨,那麼價格通常會回歸均數。

模型設定:

1、當價格站上n天bollinger band的通道上緣時,且下一根kbar向下穿過bollinger band的上緣時,放空。

2、當價格跌破n天bollinger band的通道下緣時,且下一根kbar向上穿過bollinger band的下緣時,做多。

會想等價格跌破bollinger band上緣或站上bollinger band下緣時,才進場,是怕如果趨勢太強,有可能價格一直在bollinger band上緣或下緣,意思就是,別逆勢去空在勢頭上,或太快去接掉下來的刀子。當然也有可能,放空了一口後,價格開始下跌,然後一直在band的下緣都站不上去,就都不會反手做多,會變成很可觀的獲利。

附上程式碼:

inputs:
Length( 20 ),stdDn( 2 ),stdUp( 2 );


variables:
LowerBand( 0 ), UpperBand( 0 );

LowerBand = BollingerBand( close, Length, -stdDn ) ;
UpperBand = BollingerBand( close, Length, stdUp ) ;

if CurrentBar > 1 and close crosses over LowerBand then
Buy ( "BB_long" ) next bar at LowerBand stop ;

if CurrentBar > 1 and close crosses under UpperBand then
Sell ( "BB_short" ) next bar at UpperBand stop ;

arrow
arrow
    全站熱搜

    JinShiang 發表在 痞客邦 留言(0) 人氣()