设为首页收藏本站

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

dual thrust 策略源码有问题求指点 [复制链接]

Rank: 2

精华
0
UID
275970
积分
66
帖子
23
主题
13
阅读权限
30
注册时间
2019-2-24
最后登录
2021-5-24
跳转到指定楼层
1#
发表于 2019-6-8 12:06:44 |只看该作者 |倒序浏览
回测螺纹钢5分钟,从2010--2018年,㫫示年化收益率为400%以上,肯定不可能,但就是找不到问题点,
求帮忙,哪位大神帮忙看看程序有什问题?谢谢!

Params
        Numeric K1(0.7);                               
        Numeric K2(0.15);                          
        Numeric Mday(1);         
        Numeric Nday(1);
        Numeric lost(1);
        Numeric offset(0);
Vars
        Numeric BuyRange(0);                       
        Numeric SellRange(0);
        Numeric BuyTrig (0);
        Numeric SellTrig(0);
        Numeric HH;
        Numeric LL;
        Numeric HC;
        Numeric LC;
        Numeric i_offset;
        Numeric BuyPosition;
        Numeric SellPosition;

Begin

        // 集合竞价和小节休息过滤
        If(!CallAuctionFilter()) Return;
       
        If(CurrentBar > 44*Max(Mday,Nday))
                       
         {
                i_offset = offset*MinMove*PriceScale;
                HH = Highest(HighD(1),Mday);
                HC = Highest(CloseD(1),Mday);
        LL = Lowest(LowD(1),Mday);
        LC = Lowest(CloseD(1),Mday);
               
      If ( ( HH - LC ) >= ( HC - LL ))
        {
                SellRange = HH - LC;
                               
           } Else  
              {
                     SellRange = HC - LL;                       
              }
            HH = Highest(HighD(1),Nday);
                HC = Highest(CloseD(1),Nday);
        LL = Lowest(LowD(1),Nday);
        LC = Lowest(CloseD(1),Nday);
          
          If ( ( HH - LC ) >= ( HC - LL ))
        {
                BuyRange = HH - LC;
                               
           } Else  
              {
                     BuyRange = HC - LL;                       
              }
          
                BuyTrig = K1*BuyRange;
                SellTrig = K2*SellRange;
                BuyPosition = OpenD(0)+ BuyTrig;
                SellPosition = OpenD(0)- SellTrig;
               
                PlotNumeric("BuyPosition",BuyPosition);
                PlotNumeric("SellPosition",SellPosition);
                       
             If( High >= BuyPosition)
                       {
                              Buy(lost,Max(Open,SellPosition)+i_offset);  // Buy(lost,Max(Open,SellPosition)+i_offset);[1]
                                  Return;
                    }  
                     If( Low <= SellPosition )
                                {
                                 SellShort(lost,Min(Open,SellPosition)-i_offset);  //SellShort(lost,Min(Open,SellPosition)-i_offset);[1]
                                Return;
                                }  
               
          }
            
       
       
        End







附件: 你需要登录才可以下载或查看附件。没有帐号?注册

Rank: 1

精华
0
UID
249289
积分
1
帖子
1
主题
0
阅读权限
10
注册时间
2017-3-27
最后登录
2019-7-23
2#
发表于 2019-7-23 17:16:15 |只看该作者
未来函数啊老哥

使用道具 举报

Rank: 2

精华
0
UID
275970
积分
66
帖子
23
主题
13
阅读权限
30
注册时间
2019-2-24
最后登录
2021-5-24
3#
发表于 2019-7-23 20:53:23 |只看该作者
tradefish 发表于 2019-7-23 17:16
未来函数啊老哥

求指教,帮忙,未来函数在哪? 谢谢!

使用道具 举报

Rank: 1

精华
0
UID
205944
积分
22
帖子
13
主题
1
阅读权限
10
注册时间
2015-3-26
最后登录
2021-4-5
4#
发表于 2019-7-24 17:49:39 |只看该作者
If( High >= BuyPosition)
                       {
                              Buy(lost,Max(Open,SellPosition)+i_offset);  // Buy(lost,Max(Open,SellPosition)+i_offset);[1]
                                  Return;
                    }  
                     If( Low <= SellPosition )
                                {
                                 SellShort(lost,Min(Open,SellPosition)-i_offset);  //SellShort(lost,Min(Open,SellPosition)-i_offset);[1]
                                Return;
                                }  
               
          }当价格突破BuyPosition 你能买到open或者sellposition吗?

使用道具 举报

Rank: 2

精华
0
UID
275970
积分
66
帖子
23
主题
13
阅读权限
30
注册时间
2019-2-24
最后登录
2021-5-24
5#
发表于 2019-8-3 23:37:25 |只看该作者
chao1989106 发表于 2019-7-24 17:49
If( High >= BuyPosition)
                       {
                              Buy(lost,Max(Open,Se ...

确实,谢谢!

使用道具 举报

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

bottom

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

GMT+8, 2024-4-19 19:49

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部