开拓者期货期权程序化系统交易论坛

标题: 如何编写上下通道买卖信号? [打印本页]

作者: hbxtxq77    时间: 2015-5-12 23:55:15     标题: 如何编写上下通道买卖信号?

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

[attach]31497[/attach]

自己写的空头代码,如何过滤掉多头趋势中的信号?
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[1]>hiband2[1])
                 {
                   SellShort(lots,0);
                 }
        Else
               
                 if ( LoBand1[1]<LoBand2[1])
                 {
            BuyToCover(lots,0);
                 }
               
End
作者: hbxtxq77    时间: 2015-5-28 21:38:45

希望大家能把自己的想法注入到这个程序中。。。
作者: hbxtxq77    时间: 2015-6-9 21:14:32

[attach]31729[/attach][attach]31729[/attach][attach]31729[/attach]
经过改造的上下通道突破。
作者: hbxtxq77    时间: 2015-6-9 21:16:11

回测报告
[attach]31730[/attach][attach]31730[/attach]
作者: hbxtxq77    时间: 2015-6-16 21:35:31

加上止损,效果更好。
作者: hbxtxq77    时间: 2015-6-16 21:44:38

加上止损的回测




欢迎光临 开拓者期货期权程序化系统交易论坛 (http://bbs.tb18.net/) Powered by Discuz! X2