设为首页收藏本站

 找回密码
 注册
查看: 1934|回复: 0
打印 上一主题 下一主题

为什么我的系统是日内,测试的结果却是隔夜,高手帮我纠 [复制链接]

Rank: 1

精华
0
UID
114626
积分
7
帖子
6
主题
1
阅读权限
10
注册时间
2013-1-5
最后登录
2014-8-11
跳转到指定楼层
1#
发表于 2013-1-28 21:01:15 |只看该作者 |倒序浏览
//------------------------------------------------------------------------
// 简称: break
// 名称:
// 类别: 公式应用
// 类型: 用户应用
// 输出:
//------------------------------------------------------------------------



//------------------------------------------------------------------------
// 编译版本        GS2010.12.08
// 用户版本        2013/01/24 09:42
// 版权所有        wesleylab
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------

Params
        Numeric PercentOfRange(0.3);
        Numeric exitOnCloseMins(14.55);
        Numeric RiskRatio(1);                   // % Risk Per N ( 0 - 100)
    Numeric ATRLength(20);                  // 平均波动周期 ATR Length
       
       
Vars
    Numeric DayOpen;
        Numeric preDayRange;
        Numeric UpperBand;
    Numeric lowerBand;
        Numeric MyPrice;
       
       
        Numeric TotalEquity;
        NumericSeries AvgTR;       
        Numeric TurtleUnits;  
        Numeric N;
  
Begin
   
       
        AvgTR = XAverage(TrueRange,ATRLength);
        N = AvgTR[1];       
    TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();
    TurtleUnits = (TotalEquity*RiskRatio/100) /(N * ContractUnit()*BigPointValue());
    TurtleUnits = IntPart(TurtleUnits); // 对小数取整
       
       
       
        DayOpen=OpenD(0);  //今天
       
        preDayRange=HighD(1)-LowD(1);  //昨天的最高最低点的差
       
        UpperBand=DayOpen+preDayRange*PercentOfRange;
        lowerBand=DayOpen-preDayRange*PercentOfRange;

        If(MarketPosition!=1&&high>=UpperBand&&time<exitOnCloseMins/100)
           {
          
             MyPrice=UpperBand;
                 
                 If(open>MyPrice)  MyPrice=open;
                 
                 Buy(TurtleUnits,MyPrice);
                  
             Return;
           }

          
        if(MarketPosition!=-1&&low<=lowerBand&&time<exitOnCloseMins/100)   
           {
             MyPrice=lowerBand;
                 
         if(open<MyPrice) MyPrice=open;
                       
                 SellShort(TurtleUnits,MyPrice);       
                 
                 return;
           }


         If(Date[-1]!=InvalidInteger && Date!=Date[-1])
     {
         Sell(0,Close);
         BuyToCover(0,Close);
     }Else If(Date==CurrentDate && Time>=exitOnCloseMins/100)
     {
        Sell(0,Open);
         BuyToCover(0,Open);
     }

         
       
End
您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-3 04:43

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部