R-Breaker交易系统模型原理说明及示意图
[p=21, 2, left][url=http://photo.blog.sina.com.cn/showpic.html#blogid=550cfa7101018hz5&url=http://s6.sinaimg.cn/orignal/550cfa71gdbc843a0c6b5][img=0,457]http://s6.sinaimg.cn/mw690/550cfa71gdbc843a0c6b5&690[/img][/url][/p][p=21, 2, left] [/p][p=21, 2, left]R-Breaker是一种短线交易策略,它结合了趋势和反转两种交易方式。[/p][p=21, 2, left]交易系统的基本原理如下:
1. 根据前一个交易日的收盘价、最高价和最低价数据通过一定方式计算出六个价位,从大到小依次为:突破买入价、观察卖出价、反转
卖出价、反转买入价、观察买入价、突破卖出价。
以此来形成当前交易日盘中交易的触发条件。这里,通过对计算方式的调整,可以调节六个价格间的距离,进一步改变触发条件。[/p][p=21, 2, left]
2. 追踪盘中价格走势,实时判断触发条件。具体条件如下:
当日内最高价超过观察卖出价后,盘中价格出现回落,且进一步跌破反转卖出价构成的支撑线时,采取反转策略,即在该点位(反手、开仓)做空;
当日内最低价低于观察买入价后,盘中价格出现反弹,且进一步超过反转买入价构成的阻力线时,采取反转策略,即在该点位(反手、开仓)做多;
在空仓的情况下,如果盘中价格超过突破买入价,则采取趋势策略,即在该点位开仓做多;
在空仓的情况下,如果盘中价格跌破突破卖出价,则采取趋势策略,即在该点位开仓做空。[/p][p=21, 2, left]
3. 设定止损条件。当亏损达到设定值后,平仓。
4. 设定过滤条件。当前一个交易日波幅过小,该交易日不进行交易。
5. 在每日收盘前,对所持合约进行平仓。
6. 可使用1分钟、5分钟或10分钟等高频数据进行判断。[/p] TS源码:
[code]
{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
if t>=notbef and t=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;
[/code]
中轨上顶部区间:ssetup:=昨日最高+0.35*(昨天收盘-昨天最低);
中轨上区间:senter+(昨最高-中轨上顶部区间)/3 // senter:=((1+0.07)/2*(昨最高+昨最低)-0.07*昨天最低;
中轨下区间:benter-(中轨下顶部区间-昨最低)/3 // benter:=((1+0.07)/2*(昨最高+昨最低)-0.07*昨天最高;
中轨下顶部区间:bsetup:=昨最低-0.35*(昨最高-昨收盘);
上轨:bbreak:=(ssetup+0.25*(ssetup-bsetup);
下轨:sbreak:=bsetup-0.25*(ssetup-bsetup);
当价格直接突破上轨,开多。 否则, 当今日最高价大于中轨上区间,并且小于上轨运行,价格如果下穿中轨上区间后,开空。
当价格直接突破下轨,开空。 否则, 当今日最低价小于中轨下区间,并且大于下轨运行,价格如果上穿中轨下区间后,开多。 R-Breaker金字塔上源码:
[code]
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);
if barpos=1 then begin
startnow:=0;
div:=max(xdiv,1);
end
hh:=ref(hitoday,1);
cc:=ref(close,1);
ll:=ref(ltoday,1);
if date>ref(date,1) then begin
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
if high>hitoday then hitoday:=high;
if low<ltoday then ltoday:=low;
if time>=notbef and time<notaft and startnow>=2 and rfilter then begin
if hitoday>=ssetup and holding>=0 then begin
if low<=senter+(hitoday-ssetup)/div then begin
sell(1,holding,limitr,senter+(hitoday-ssetup)/div);
sellshort(1,1,limitr,senter+(hitoday-ssetup)/div);
end
end
if ltoday<=bsetup and holding<=0 then begin
if high>=benter-(bsetup-ltoday)/div then begin
if high>=benter-(bsetup-ltoday)/div then begin
sellshort(1,holding,limitr,benter-(bsetup-ltoday)/div);
buy(1,1,limitr,benter-(bsetup-ltoday)/div);
end
end
end
if holding<0 then begin
if high-enterprice>=i_reverse then
sellshort(1,enterprice+i_reverse);
end
if holding>0 then begin
if enterprice-low>=i_reverse then
sell(1,enterprice-i_reverse);
end
if holding=0 then begin
if high>=bbreak then
buy(1,bbreak);
end
if holding=0 then begin
if low<=sbreak then
sellshort(1,sbreak);
end
end
if time>=notaft then begin
if holding<0 then
sellshort(1,holding,limitr,open);
if holding>0 then
sell(1,holding,limitr,open);
end
盈亏:asset-500000,noaxis,coloryellow,linethick2;
[/code]
页:
[1]