帮忙编写一下,把TB策略转换成文华8可以用 (文华财经WH6赢顺V6.7)

投资者咨询:帮忙编写一下,把TB策略转换成文华8可以用 (文华财经WH6赢顺V6.7)
来源:文华财经  日期:2018-8-24 9:48
 Params
Numeric rn(0);
Numeric ss(1);
Vars
Numeric notbef(9.00);
Numeric notaft(14.55);
Numeric f1(0.01);
Numeric f2(1);
Numeric f3(0.01);
Numeric reverse(1.00);
Numeric rangemin(0.1);
Numeric xdiv(3);
Numeric offset(5);
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;
Numeric i_offset;
Numeric offset2;
Begin


If(!CallAuctionFilter()) Return;
If(BarStatus==2 && Time==0.090000 && high==low ) return; 
i_offset = offset*MinMove*PriceScale;
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);// 将第1个全局变量设置为0,将第2个全局变量设置为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)//当前公式应用商品在当前Bar的时间乘以100》=9点或者小于14.55分
{ 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(0,Close);
                        SetGlobalVar(1,Time);
                        Return;}}
        if(ltoday<=bsetup and marketposition<1  and GetGlobalVar(1)<1)
        { If(High>=(benter-(bsetup-ltoday)/div))
                {  Buy(0,close);
                        SetGlobalVar(1,Time);
                        Return; }}

        if(marketposition==-1)
        { SetGlobalVar(0,1);
                if(High-EntryPrice>=i_reverse)
                {    BuyToCover(0,Close);
                        Return;}}
        if(marketposition==1)
        {   SetGlobalVar(0,1);
             if(EntryPrice-Low>=i_reverse)
                { Sell(0,Close);
                   Return;}}
        if(marketposition==0)
        { if(High>=bbreak and GetGlobalVar(0) == 0)
                {   Buy(0,Close);
                      Return; }}
        if(marketposition==0)
        { if(low<=sbreak  and GetGlobalVar(0) == 0)
                {SellShort(0,Close);
                  Return;   } }}

if(Time*100>=notaft and Time<0.1600 and rn>=1)
{  if(marketposition==-1)
        {  BuyToCover(0,Close);}
        if(marketposition==1)
        {  Sell(0,Close);}}
End

投资者咨询:帮忙编写一下,把TB策略转换成文华8可以用 (文华财经WH6赢顺V6.7)
来源:文华财经  日期:2018-8-24 9:48
 好的,谢谢

技术人员回复
日期:2018-8-24 10:02
建议您使用MQ软件,  可以兼容TB的代码的,稍后我们给您改写下

MQ下载地址:http://www.wenhua.com.cn/

 
技术人员回复
日期:2018-8-24 13:51
请加载到MQ软件使用:

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看文件名:b.zip



编写》编写公式》文件》导入即可
投资者咨询:帮忙编写一下,把TB策略转换成文华8可以用 (文华财经WH6赢顺V6.7)
来源:文华财经  日期:2018-8-24 9:48
 能与wh8通用吗

技术人员回复
日期:2018-8-24 16:55
wh8不行的,信号逻辑等和您上面TB代码相差比较多,不适合改写到wh8上。

建议您下载MQ版本,一般TB的代码都是可以兼容的