国外成熟策略R-Breaker分享,提供翻译后的TB源码,日内系统[开拓者公式]
- 内容: R-Breaker这个系统,可能很多人比我熟悉,也更为了解,有错误处还请谅解
另外我并没实盘验证,在信号那加入了一个逻辑锁,用于控制实盘时有信号,但又不会多次满足反复开仓,这个逻辑锁我很多系统都会有,实战很好用。
这个系统本身是用在SP上,多次出现在实盘赛的前列。
我觉得这个系统的构架和思维非常好,直接拿着套国内商品可能表现很差,不过大家能看到这个系统的核心思想就足够了,可以借鉴。忘了说了,得用TB V4,要不V3的系列值传递那还得接力一下 - TB源码:
- //------------------------------------------------------------------------
- // 简称: R_Breaker
- // 名称:
- // 类别: 公式应用
- // 类型: 用户应用
- // 输出: 穿堂风分享(平台: WWW.CXH99.COM )
- //------------------------------------------------------------------------
- /*R-Breaker*/
- 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_rangemin = 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
- // 用户版本 2011/06/27 14:29
- // 版权所有
- // 更改声明 TradeBlazer Software保留对TradeBlazer平台
- // 每一版本的TrabeBlazer公式修改和重写的权利
- //------------------------------------------------------------------------
- TS源码:
- {R-Breaker}
- {***********SystemSetup*******************
- Trading between 9:15 and 14:29 ChicagoTime only
- MMStop $1000
- Close End of Day
- 10 min Time Frame
- ******************************************}
- input:notbef(715),notaft(1229);
- var:{input:}f1(.35),f2(0.07),f3(.25),reverse(2.00),
- rangemin(1.15),xdiv(3);
- var:ssetup(0),bsetup(0),senter(0),benter(0),bbreak(0),sbreak(0),
- ltoday(0),hitoday(9999),startnow(0),div(0),
- rfilter(false);
- if currentbar=1 then startnow=0;
- div=maxlist(xdiv,1);
- if d>d[1] then begin
- startnow=startnow+1;
- ssetup=hitoday[1]+f1*(c[1]-ltoday[1]);
- senter=((1+f2)/2)*(hitoday[1]+c[1])-(f2)*ltoday[1];
- benter=((1+f2)/2)*(ltoday[1]+c[1])-(f2)*hitoday[1];
- bsetup=ltoday[1]-f1*(hitoday[1]-c[1]);
- bbreak=ssetup+f3*(ssetup-bsetup){(1.3625*hitoday[1]+.45*c[1])-.8125*ltoday[1]};
- sbreak=bsetup-f3*(ssetup-bsetup){(1.3625*ltoday[1]+.45*c[1])-.8125*hitoday[1]};
- hitoday=h;
- ltoday=l;
- rfilter=hitoday[1]-ltoday[1]>=rangemin;
- end;
- if h>hitoday then hitoday=h;
- if l<ltoday then ltoday=l;
- if t>=notbef and t<notaft and startnow>=2 and rfilter and
- date>entrydate(1) then begin
- if hitoday>=ssetup and marketposition>-1 then
- SELL("Rlev SE") senter+(hitoday-ssetup)/div stop;
- if ltoday<=bsetup and marketposition<1 then
- BUY("Rlev LE") benter-(bsetup-ltoday)/div stop;
- if marketposition=-1 then
- BUY("RbUP LE") entryprice+reverse stop;
- if marketposition=1 then
- SELL("RbDN SE") entryprice-reverse stop;
- if marketposition=0 then
- BUY("Break LE") bbreak stop;
- if marketposition=0 then
- SELL("Break SE") sbreak stop;
- end;
- if t>=notaft and t<>sess1endtime then begin
- if marketposition=-1 then
- EXITSHORT("RbUP SX") entryprice+reverse stop;
- if marketposition=1 then
- EXITLONG("RbDN LX") entryprice-reverse stop;
- EXITSHORT("Late SX") h+.05 stop;
- EXITLONG("Late LX") l-.05 stop;
- END;
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 262069696 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容