- 精华
- 0
- 在线时间
- 61 小时
- UID
- 110162
- 积分
- 103
- 帖子
- 75
- 阅读权限
- 30
- 注册时间
- 2012-4-23
- 最后登录
- 2013-2-13
- 精华
- 0
- UID
- 110162
- 积分
- 103
- 帖子
- 75
- 主题
- 4
- 阅读权限
- 30
- 注册时间
- 2012-4-23
- 最后登录
- 2013-2-13
|
本帖最后由 tufeiyige 于 2012-7-21 11:57 编辑
R-breaker trading system
R-breaker 是一个专门使用在股票指数上的交易系统,该系统为日内交易
策略,不持仓过夜。出场指令为止损或是收盘。每天交易不超过2 笔,
很多时候一天内可能没有交易。该系统的特点是,结合了趋势和反转两
种交易方法,既进行趋势交易也进行反转交易。自1993 年公开发布以
来,系统的交易法则没有改变过,该系统已经在市场上存活了 14 年之
久。尤其是当指数的日内波动较大时,该系统的收益更好,反之则没有
交易机会。
在这里要感谢 TB网友 穿堂风 对此公式的翻译
// 简称: 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
连接 http://bbs.tradeblazer.net/thread-15508-1-1.html |
|