hbxtxq77 发表于 2015-5-12 23:55:15

如何编写上下通道买卖信号?

本帖最后由 hbxtxq77 于 2015-5-28 20:49 编辑



自己写的空头代码,如何过滤掉多头趋势中的信号?
Params
         Numeric B_Length1(13);// 长周期突破
         Numeric B_Length2(3);
         
         Numeric lots(1);// 头寸大小

Vars
         NumericSeries HiBand1;
         NumericSeries HiBand2;
         NumericSeries LoBand1;
         NumericSeries LoBand2;
      
          NumericSeries MA3;
//以下多头
Begin
   
         HiBand1 = highest(high,B_Length1);//长
         LoBand1 = lowest(low,B_Length1);//长
         HiBand2 = highest(high,B_Length2);//短
         LoBand2 = lowest(low,B_Length2);//短
                 MA3 = ((High-Low)/2+LOW);
         PlotNumeric("HiBand1",HiBand1);
         PlotNumeric("LoBand1",LoBand1);
         plotnumeric("HiBand2",HiBand2);
         plotnumeric("LoBand2",LoBand2);
                 PlotNumeric("MA3",MA3);
                 
                 
                 if(HiBand1>hiband2)
                 {
                   SellShort(lots,0);
                 }
        Else
               
                 if ( LoBand1<LoBand2)
                 {
            BuyToCover(lots,0);
                 }
               
End

hbxtxq77 发表于 2015-5-28 21:38:45

希望大家能把自己的想法注入到这个程序中。。。:lol

hbxtxq77 发表于 2015-6-9 21:14:32


经过改造的上下通道突破。

hbxtxq77 发表于 2015-6-9 21:16:11

回测报告

hbxtxq77 发表于 2015-6-16 21:35:31

加上止损,效果更好。

hbxtxq77 发表于 2015-6-16 21:44:38

加上止损的回测
页: [1]
查看完整版本: 如何编写上下通道买卖信号?