加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

R-Breaker交易系统简介

(2013-01-22 17:17:47)
标签:

程序化

交易

理财

期货

r-breaker

分类: 程序化交易资料

R-Breaker是个经典的具有长生命周期的日内模型。曾14年排名Future Trust杂志年度前10最赚钱的策略。 

类型:日内趋势追踪+反转策略

周期:1分钟、5分钟
主要的思想为:

根据前一个交易日的收盘价最高价最低价数据通过一定方式计算出六个价位,从大到小依次为:突破买入价(Bbreak)、观察卖出价(Ssetup)、反转卖出价(Senter)、反转买入价(Benter)、观察买入价(Bsetup)、突破卖出价(Sbreak)以此来形成当前交易日盘中交易的触发条件。这里,通过对计算方式的调整。可以调节六个价格间的距离。 

交易规则:

反转:

持多单,当日内最高价超过观察卖出价后,盘中价格出现回落,且进一步跌破反转卖出价构成的支撑线时,采取反转策略,即在该点位反手做空;

持空单,当日内最低价低于观察买入价后,盘中价格出现反弹,且进一步超过反转买入价构成的阻力线时,采取反转策略,即在该点位反手做多;

突破:

在空仓的情况下,如果盘中价格超过突破买入价,则采取趋势策略,即在该点位开仓做多
在空仓的情况下,如果盘中价格跌破突破卖出价,则采取趋势策略,即在该点位开仓做空

TB中的代码:

 

//------------------------------------------------------------------------

// 简称: r_BRTAKER

// 名称: 破坏者

// 类别: 公式应用

// 类型: 用户应用

// 输出:

//------------------------------------------------------------------------

Params

  Numeric notbef(9.00);

  Numeric notaft(14.55); 

  Numeric f1(0.35);

  Numeric f2(0.07);

  Numeric f3(0.25);

  Numeric reverse(1.00);

  Numeric rangemin(0.2);

  Numeric xdiv(3);

Vars

  NumericSeries ssetup(0);

  NumericSeries bsetup(0);

  NumericSeries senter(0);

  NumericSeries benter(0);

  NumericSeries bbreak(0);

  NumericSeries sbreak(0);

  NumericSeries ltoday(0);

  NumericSeries hitoday(9999);

  NumericSeries startnow(0);

  NumericSeries div(0);

  BoolSeries rfilter(false);

  Numeric i_reverse;

  Numeric i_rangemin;

  Numeric i_vB;

  Numeric i_vS;

Begin

    i_reverse = reverse*(OpenD(0)/100);

    i_reverse = rangemin*(OpenD(0)/100);

   if(BarStatus==0)

    {

     startnow=0;

     div=max(xdiv,1);

    }

   if(Date != Date[1])

    {

     SetGlobalVar(0,0);

     SetGlobalVar(1,0);

     startnow=startnow+1;

     ssetup=hitoday[1]+f1*(Close[1]-ltoday[1]);

     senter=((1+f2)/2)*(hitoday[1]+Close[1])-(f2)*ltoday[1];

     benter=((1+f2)/2)*(ltoday[1]+Close[1])-(f2)*hitoday[1]; 

     bsetup=ltoday[1]-f1*(hitoday[1]-Close[1]);

     bbreak=ssetup+f3*(ssetup-bsetup);

     sbreak=bsetup-f3*(ssetup-bsetup);

     hitoday=High;

     ltoday=Low;

     rfilter=(hitoday[1]-ltoday[1])>=i_rangemin;

    }

    if(High>hitoday)

    {

       hitoday=High;

    }

    if(Low<ltoday)

    {

       ltoday=Low;

    }

    if(Time*100>=notbef and Time*100<notaft and startnow>=2 and rfilter)

    {

       if(Time != GetGlobalVar(1) and GetGlobalVar(1) != 0)

{

         SetGlobalVar(1,10000);

}

       if(hitoday>=ssetup and marketposition>-1 and GetGlobalVar(1)<1)

{

           If(Low<=(senter+(hitoday-ssetup)/div))

   {

             SellShort(1,senter+(hitoday-ssetup)/div);

     SetGlobalVar(1,Time);

             Return;

            }

         }

       if(ltoday<=bsetup and marketposition<1  and GetGlobalVar(1)<1)

       {

         If(High>=(benter-(bsetup-ltoday)/div))

         {

Buy(1,benter-(bsetup-ltoday)/div);

SetGlobalVar(1,Time);

Return;

          }

        }

       if(marketposition==-1)

      {

         SetGlobalVar(0,1);

         if(High-EntryPrice>=i_reverse)

  {

             BuyToCover(1,entryprice+i_reverse);

     Return;

  }

       }

       if(marketposition==1)

       {

         SetGlobalVar(0,1);

          if(EntryPrice-Low>=i_reverse)

          {

           Sell(1,entryprice-i_reverse);

   Return;

           }

}

      if(marketposition==0)

     {

        if(High>=bbreak and GetGlobalVar(0) == 0)

       {

Buy(1,bbreak);

Return;

        }

     }

 

     if(marketposition==0)

     {

        if(low<=sbreak  and GetGlobalVar(0) == 0)

       {

SellShort(1,sbreak);

Return;

}

     }

  }

if(Time*100>=notaft and Time<0.1600)

    {

     if(marketposition==-1)

      {

 BuyToCover(1,Open);

      }

 if(marketposition==1)

    {

 Sell(1,Open);

     }

  }

End

//------------------------------------------------------------------------

// 编译版本 GS2010.12.08

// 用户版本 2012/07/24 11:01

// 版权所有 程序化模型编写服务永久地址http://uucxh.taobao.com/

// 更改声明 TradeBlazer Software保留对TradeBlazer平台

// 每一版本的TrabeBlazer公式修改和重写的权利

//------------------------------------------------------------------------

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有