设为首页收藏本站

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

请帮我看下为什么总是出现交易讯号消失 [复制链接]

Rank: 1

精华
0
UID
227325
积分
28
帖子
16
主题
6
阅读权限
10
注册时间
2016-1-23
最后登录
2018-6-7
跳转到指定楼层
1#
发表于 2016-8-6 07:24:06 |只看该作者 |倒序浏览
请帮我看下为什么总是出现交易讯号消失,导致您的持仓不匹配呢

Params
    Numeric Lots(1);
 Numeric ExitOnCloseMins(14.59);  
 Numeric maLen1(10);
    Numeric maLen2(30);   
Vars      
       Numeric ma1;  
       Numeric ma2;  
        Numeric TakeProfit(1);
        Numeric TakeProfit2(2);
        Numeric MinPoint;
        Numeric MyEntryPrice;
        Numeric MyExitPrice;

        NumericSeries HighestAfterEntry; //  开仓后出现的最高价
       NumericSeries LowestAfterEntry; //  开仓后出现的最低价
        Numeric StopLine(0);
        
Begin
        ma1 = Average(Open,maLen1);
       ma2 = Average(Open,maLen2);   
        MyEntryPrice = AvgEntryPrice;   
        HighestAfterEntry = Close[1];
       LowestAfterEntry = Close[1];
        Commentary("ma1: "+Text(ma1));
        Commentary("ma2: "+Text(ma2));
        
     If(CurrentBar > maLen2)
     {   
        If(MarketPosition==0)
            {   
               if((Open>=ma1)&&(ma1>ma2))
                   {   
                       MyEntryPrice==open;
                       Buy(lots,MyEntryPrice);
               HighestAfterEntry = Max(HighestAfterEntry,AvgEntryPrice);
                   LowestAfterEntry = Min(LowestAfterEntry,AvgEntryPrice);
                      Return;
                   }
                   if((Open<ma1)&&(ma1<ma2))
                   {   
                       MyEntryPrice==open;
                       SellShort(lots,MyEntryPrice);
                           HighestAfterEntry = Max(HighestAfterEntry,AvgEntryPrice);
                           LowestAfterEntry = Min(LowestAfterEntry,AvgEntryPrice);
                       Return;
                   }  
                   HighestAfterEntry = Max(HighestAfterEntry,High);  
                  LowestAfterEntry = Min(LowestAfterEntry,Low);  
                  
            }        
                 
        If(MarketPosition==1)//多仓
            {  
               
                   If(High>=ma1&&(High>HighestAfterEntry[1]))//增仓
                   {  MyEntryPrice=Open;
                          Buy(Lots,Open);
                          HighestAfterEntry=High;
                          Commentary("增仓: "+Text(Open));
                   }
                   If(High>=ma1&&(High<HighestAfterEntry[1]))//未突破前期高位反手
                    {  
                          MyEntryPrice=Open;
                          SellShort(1,MyEntryPrice);
                    }
                   If(Low<ma1&&(Low<LowestAfterEntry[1]))//止损并反手
                    {
                         MyExitPrice=Open;
                          Sell(0,Open);
                          
                          MyEntryPrice=MyExitPrice;
                          SellShort(1,Open);
                          LowestAfterEntry=Low;
                   }
                  
                   If(Low<ma1&&(Low>LowestAfterEntry[1]))//未突破前期低位增仓
                    {
                          MyEntryPrice=Open;
                          Buy(1,MyEntryPrice);  
                   }
           }else If(MarketPosition==-1)//空仓
            {   
               
                   If(Low<ma1&&(Low<LowestAfterEntry[1]))//增仓
                    {
                          MyEntryPrice=Open;
                          SellShort(1,Open);
                          LowestAfterEntry=Low;
                   }
                   If(Low<=ma1&&(Low>LowestAfterEntry[1]))//未突破前期高位反手
                    {
                          MyEntryPrice=Open;
                          Buy(1,MyEntryPrice);
                    }  
                   If(High>=ma1&&(High>HighestAfterEntry[1]))//止损并反手
                    {
                          MyExitPrice=Open;
                          BuyToCover(0,Open);
                          
                          MyEntryPrice=MyExitPrice;
                          Buy(1,Open);  
                          HighestAfterEntry=High;
                    }
                        
                   If(High>=ma1&&(High<HighestAfterEntry[1]))//未突破前期低位增仓
                    {
                          MyEntryPrice=Open;
                          SellShort(1,MyEntryPrice);   
                    }
                  
           }
           
     }
         

Rank: 2

精华
0
UID
217043
积分
69
帖子
38
主题
17
阅读权限
30
注册时间
2015-8-14
最后登录
2024-4-21
2#
发表于 2016-8-8 16:45:21 |只看该作者
大哥,是你吗?把这个不能用的换了我那个能用的

使用道具 举报

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

bottom

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

GMT+8, 2024-5-11 12:30

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部