RBREAK策略.docx

上传人:b****5 文档编号:4599770 上传时间:2022-12-07 格式:DOCX 页数:10 大小:36.55KB
下载 相关 举报
RBREAK策略.docx_第1页
第1页 / 共10页
RBREAK策略.docx_第2页
第2页 / 共10页
RBREAK策略.docx_第3页
第3页 / 共10页
RBREAK策略.docx_第4页
第4页 / 共10页
RBREAK策略.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

RBREAK策略.docx

《RBREAK策略.docx》由会员分享,可在线阅读,更多相关《RBREAK策略.docx(10页珍藏版)》请在冰豆网上搜索。

RBREAK策略.docx

RBREAK策略

R-Breaker是个经典的具有长生命周期的日内模型。

曾14年排名FutureTrust杂志年度前10最赚钱的策略。

类型:

日内趋势追踪+反转策略

周期:

1分钟、5分钟

此主题相关图片如下:

r-breaker.jpg

主要的思想依据上图为:

根据前一个交易日的收盘价、最高价和最低价数据通过一定方式计算出六个价位,从大到小依次为:

突破买入价(Bbreak)、观察卖出价(Ssetup)、反转卖出价(Senter)、反转买入价(Benter)、观察买入价(Bsetup)、突破卖出价(Sbreak)。

以此来形成当前交易日盘中交易的触发条件。

这里,通过对计算方式的调整。

可以调节六个价格间的距离。

交易规则:

反转:

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

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

突破:

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

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

代码:

//策略:

R-Breaker

//类型:

日内

//修订时间:

2012.11.1

//DesignedByRogarz

input:

ss(1,1,100,10);

手数:

=ss;

n:

=barslast(date<>ref(date,1));

昨高:

=callstock(stklabel,vthigh,6,-1);//昨高

昨低:

=callstock(stklabel,vtlow,6,-1);//昨低

昨收:

=callstock(stklabel,vtclose,6,-1);//昨收

a:

=hhv(h,n+1);

b:

=llv(l,n+1);

ifN>=1thenbegin

今高:

=a;//今高

今低:

=b;//今低

end

观察卖出价:

昨高+0.35*(昨收-昨低);//ssetup

反转卖出价:

(1.07/2)*(昨高+昨低)-0.07*昨低;//senter

反转买入价:

(1.07/2)*(昨高+昨低)-0.07*昨高;//benter

观察买入价:

昨低-0.35*(昨高-昨收);//bsetup

突破买入价:

(观察卖出价+0.25*(观察卖出价-观察买入价));//bbreeak

突破卖出价:

观察买入价-0.25*(观察卖出价-观察买入价);//sbreak

//条件

空仓做多条件:

=c>突破买入价andholding=0;

空仓做空条件:

=c<突破卖出价andholding=0;

多单反转条件:

=holding>0and今高>观察卖出价andc<反转卖出价;

空单反转条件:

=holding<0and今低<观察买入价andc>反转买入价;

//交易系统

iftime>=092000andtime<151000thenbegin

空仓开多:

buy(空仓做多条件,手数,market);

空仓开空:

buyshort(空仓做空条件,手数,market);

//多单反转:

if多单反转条件thenbegin

平多:

sell(1,手数,market);

翻空:

buyshort(1,手数,market);

end

//空单反转:

if空单反转条件thenbegin

平空:

sellshort(1,手数,market);

翻多:

buy(1,手数,market);

end

end

//日内平仓

iftime>=151000thenbegin

收盘平多:

sell(1,手数,market);

收盘平空:

sellshort(1,手数,market);

end

这个策略之前在论坛中有发不过。

Z7C9版:

Jinzhe版:

这个策略参照国外的经验较适用于股指,在商品上的表现一般,所以此处收盘我以股指为例。

我写这个版本,主要是为了做个可读性强的范例。

代码忠于策略本身的思想,没有设置止盈止损,各位可自行添加。

其他考虑不周,或有错的地方。

还请各位指教。

//参数版

//策略:

R-Breaker

//类型:

日内

//修订时间:

2012.11.1

//DesignedByRogarz

input:

ss(1,1,100,10),n1(0.35,0.1,1,0.05),n2(0.07,0.01,0.1,0.01),n3(0.25,0.01,1,0.05);

手数:

=ss;

n:

=barslast(date<>ref(date,1));

昨高:

=callstock(stklabel,vthigh,6,-1);//昨高

昨低:

=callstock(stklabel,vtlow,6,-1);//昨低

昨收:

=callstock(stklabel,vtclose,6,-1);//昨收

a:

=hhv(h,n+1);

b:

=llv(l,n+1);

ifN>=1thenbegin

今高:

=a;//今高

今低:

=b;//今低

end

观察卖出价:

昨高+n1*(昨收-昨低);//ssetup

反转卖出价:

((1+n2/2))*(昨高+昨低)-n2*昨低;//senter

反转买入价:

((1+n2/2))*(昨高+昨低)-n2*昨高;//benter

观察买入价:

昨低-n1*(昨高-昨收);//bsetup

突破买入价:

(观察卖出价+n3*(观察卖出价-观察买入价));//bbreeak

突破卖出价:

观察买入价-n3*(观察卖出价-观察买入价);//sbreak

//条件

空仓做多条件:

=c>突破买入价andholding=0;

空仓做空条件:

=c<突破卖出价andholding=0;

多单反转条件:

=holding>0and今高>观察卖出价andc<反转卖出价;

空单反转条件:

=holding<0and今低<观察买入价andc>反转买入价;

//交易系统

iftime>=092000andtime<151000thenbegin

空仓开多:

buy(空仓做多条件,手数,market);

空仓开空:

buyshort(空仓做空条件,手数,market);

//多单反转:

if多单反转条件thenbegin

平多:

sell(1,手数,market);

翻空:

buyshort(1,手数,market);

end

//空单反转:

if空单反转条件thenbegin

平空:

sellshort(1,手数,market);

翻多:

buy(1,手数,market);

end

end

//日内平仓

iftime>=151000thenbegin

收盘平多:

sell(1,手数,market);

收盘平空:

sellshort(1,手数,market);

end

1、

runmode:

0;

input:

notbef(090000);

input:

notaft(145500);

input:

f1(0.35);

input:

f2(0.07);

input:

f3(0.25);

input:

myreverse

(1);

input:

rangemin(0.2);

input:

xdiv(3);

variable:

ssetup=0;

variable:

bsetup=0;

variable:

senter=0;

variable:

benter=0;

variable:

bbreak=0;

variable:

sbreak=0;

variable:

ltoday=0;

variable:

hitoday=999999;

variable:

startnow=0;

variable:

div=0;

variable:

rfilter=false;

i_reverse:

=myreverse*(callstock(stklabel,vtopen,6,0)/100);

i_rangemin:

=rangemin*(callstock(stklabel,vtopen,6,0)/100);

ifbarpos=1thenbegin

startnow:

=0;

div:

=max(xdiv,1);

end

hh:

=ref(hitoday,1);

cc:

=ref(close,1);

ll:

=ref(ltoday,1);

ifdate>ref(date,1)thenbegin

startnow:

=startnow+1;

ssetup:

=hh+f1*(cc-ll);

senter:

=((1+f2)/2)*(hh+cc)-f2*ll;

benter:

=((1+f2)/2)*(ll+cc)-f2*hh;

bsetup:

=ll-f1*(hh-cc);

bbreak:

=ssetup+f3*(ssetup-bsetup);

sbreak:

=bsetup-f3*(ssetup-bsetup);

hitoday:

=high;

ltoday:

=low;

rfilter:

=hh-cc>=rangemin;

end

ifhigh>hitodaythenhitoday:

=high;

iflow

=low;

iftime>=notbefandtime=2andrfilterthenbegin

ifhitoday>=ssetupandholding>=0thenbegin

iflow<=senter+(hitoday-ssetup)/divthenbegin

sell(1,holding,limitr,senter+(hitoday-ssetup)/div);

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

end

end

ifltoday<=bsetupandholding<=0thenbegin

ifhigh>=benter-(bsetup-ltoday)/divthenbegin

ifhigh>=benter-(bsetup-ltoday)/divthenbegin

sellshort(1,holding,limitr,benter-(bsetup-ltoday)/div);

buy(1,1,limitr,benter-(bsetup-ltoday)/div);

end

end

end

ifholding<0thenbegin

ifhigh-enterprice>=i_reversethen

sellshort(1,enterprice+i_reverse);

end

ifholding>0thenbegin

ifenterprice-low>=i_reversethen

sell(1,enterprice-i_reverse);

end

ifholding=0thenbegin

ifhigh>=bbreakthen

buy(1,bbreak);

end

ifholding=0thenbegin

iflow<=sbreakthen

sellshort(1,sbreak);

end

end

iftime>=notaftthenbegin

ifholding<0then

sellshort(1,holding,limitr,open);

ifholding>0then

sell(1,holding,limitr,open);

end

盈亏:

asset-500000,noaxis,coloryellow,linethick2;

2、

n:

=barslast(date<>ref(date,1));

zg:

valuewhen(date<>ref(date,1),ref(hhv(h,n+1),1));//昨高

zd:

valuewhen(date<>ref(date,1),ref(llv(l,n+1),1));//昨低

zs:

valuewhen(date<>ref(date,1),ref(c,1));//昨收

jg:

hhv(h,n+1);//今高

jd:

llv(l,n+1);//今低

ssetup:

=zg+0.35*(zs-zd);//中轨上顶部区间

senter:

=(1.07/2)*(zg+zd)-0.07*zd;

benter:

=(1.07/2)*(zg+zd)-0.07*zg;

zgsqj:

=senter+(zg-ssetup)/3;//中轨上区间

zgxqj:

=benter-(ssetup-zd)/3;//中轨下区间

bsetup:

=zd-0.35*(zg-zs);

bbreak:

=(ssetup+0.25*(ssetup-bsetup));//上轨

sbreak:

=bsetup-0.25*(ssetup-bsetup);//下轨

ifcross(c,bbreak)thenbuy(holding=0,1,thisclose);

ifjg>zgsqjandjg

sell(holding>0,0,thisclose);

buyshort(holding=0,1,thisclose);

end

ifcross(c,sbreak)thenbuyshort(holding=0,1,thisclose);

ifjdsbreakandcross(c,zgxqj)thenbegin

sellshort(holding<0,0,thisclose);

buy(holding=0,1,thisclose);

end

 

 

 

 

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 英语考试

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1