這是先前辦活動所得到的最後一篇文章,在這裡與大家分享。

 

主題: 簡易Bollinger band 逆勢交易

作者: Badtessa

此策略基本原則是最少的參數(避免curve fitting),基本的原理(由上而下穿越up band 賣出, 由下而上穿越down band 買進),在加上一些評估

 

在台指期30min 對LELength和 SELength作最佳化得到下圖 (其他參數如程式碼)

2007~2012 來回設2000

 

 

發現(60,64)區域有不錯表現,獲利曲線如下

 

 

 

 

程式碼

 

inputs:

 

       BollingerPrice(Close),

 

       TestPriceLBand(Close),                                            

 

       LELength(20),

 

       SELength(20),

 

       NumDevsDn(2),

 

       stoploss(180000);

 

variables:

 

       var0(0),

 

       var1(0);

 

var0=BollingerBand(BollingerPrice,LELength,-NumDevsDn);

 

var1=BollingerBand(BollingerPrice,SELength,NumDevsDn);

 

condition1=CurrentBar>1andTestPriceLBandcrossesovervar0;

 

condition2=CurrentBar>1andTestPriceLBandcrossesundervar1;

 

ifcondition1andcondition3=truethenbegin                                                                   

 

       Buy("BBandLE")nextbaratvar0stop;

 

       condition3=false;

 

       end;  

 

ifcondition2andcondition3=falsethenbegin

 

                                                                   

 

       sellshort("BBandSE")nextbaratvar1stop;

 

       condition3=true;

 

       end;

 

 

 

setstoploss(stoploss)

 

 

因為是逆勢 所以勝率高 R值偏低 Z值還可接受

 

此策略在2007年以前是大賠,當時台股的趨勢都相當明確

2007之後開始有獲利表現,也間接說明台股開始有擺盪走勢出現

市場的特性在改變,也可發現順勢策略的績效比較差一點

此策略我是搭配其順勢策略來使用,所以停損設比較大

arrow
arrow
    全站熱搜

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