zyqh100032595 发表于 2019-6-8 17:19:39

真正的鳄鱼线指标

鳄鱼指标线
1.该系统是尊重于原著《量化交易新空间》中关于鳄鱼指标线的所有开仓条件、加仓条件、
   平仓条件
2.系统对分型采用尽可能的枚举进行模拟,力求最接近于原著作者表达的意思
3.对分型、AO、AC、区域、平衡线进行了明确定义
4.对“蓝光特惠”等小概率开仓事件进行了忽略,对连续6阳线平仓进行忽略。
5.请尊重作者的劳动,如有高手,可以与作者交换,做者将提供Crocodile_V3版的健壮模型!
   13592659139  




//------------------------------------------------------------------------
// 简称: Crocodile
// 名称:
// 类别: 公式应用
// 类型: 用户应用
// 输出:
//------------------------------------------------------------------------
Params
        Numeric Length1(5);
        Numeric Length2(8);
        Numeric Length3(13);
        // 离市周期 Trailing Exit Length
    Bool LastProfitableTradeFilter(true);
    Numeric lots(1);       
                                          // 使用入市过滤条件
Vars
    Numeric MinPoint;                       // 最小变动单位
        NumericSeries Chun;
        NumericSeries Chi;
        NumericSeries Er;
        NumericSeries MFI;
        NumericSeries  AO;
    NumericSeries  AC;
         Numeric        i;
    Bool        AODX;
    bool        AOCY;
        bool        AOSF;
        bool        Acs;
        bool        ACx;
        bool        ACcy;
        bool        PHXS;
        bool        PHXX;
        bool        HFX;
        bool        qy;
    Numeric     HHFX;   
    Numeric myEntryPrice;                   // 开仓价格
    Numeric myExitPrice;                    // 平仓价格
    Bool SendOrderThisBar(False);           // 当前Bar有过交易
    NumericSeries preEntryPrice(0);         // 前一次开仓的价格

Begin
    // 集合竞价过滤
    If(!CallAuctionFilter()) Return;

    If(BarStatus == 0)
    {
        preEntryPrice = InvalidNumeric;
        
    }

    MinPoint = MinMove*PriceScale;
    chun=AverageFC((h+l)/2,Length1);
        Chi=AverageFC((h+l)/2,Length2);
    Er=AverageFC((h+l)/2,Length3);
    PlotNumeric("唇线",Average((h+l)/2,Length1),0 ,Green);
        PlotNumeric("齿线",Average((h+l)/2,Length2),0, red);
        PlotNumeric("鄂线",Average((h+l)/2,Length3),0, blue);
        MFI=(h+l)/2;
        AO=(average(MFI,5)-average(MFI,34));
        AC=AO-average(AO,5);

   

    //上分形定义
       
       
        For  i=3 to 6
        if (h<h and  h<h  and h<h and h<h)
           {HFX=true;
             HHFX=h;
           }
      
       
          
       
   
   //以下为AO指标
   
    AODX=(ao>ao and ao>ao and ao>o  )  
          or (ao>ao and ao>ao and ao>ao and ao>aoand ao>o and ao>0)
          or (ao>ao and ao>ao and ao>ao and ao>ao and ao>ao and ao>ao and ao>0 and ao>0 and ao>o)
      or (ao>ao and  ao>ao and ao>ao and ao>ao and ao>ao and ao>ao and ao>ao and ao>ao and ao>o  and ao>o and ao>o and ao>o);
                               
                                  
                                                  
                                                   //蝶形买进
                                                  
        AOCY=ao<o and ao>o ; //穿越买进
    AOSF=ao<ao and ao<0 and ao<ao and ao<o   and ao>ao and   ao<ao and ao<ao;//双峰买进       
                                                  
   
   //以下为AC指标
   
   ACS=AC<Ac and ac>ac   and   ac>ac and ac>o;//AC零轴之上买进;
   ACX=ac<ac and  ac<ac and ac<ac and ac<ac and ac<o;//AC 零轴之下买进
   ACCY=ac<acand  ac<ac and ac>0 and ac<o;//AC 穿越买进
   

   //以下为区域
   
          QY=ao>o and ac>o ;
   
   
   //以下为平衡线指标
   
     PHXX= high<high and  high<high and high<er; //平衡线下买入;
         PHXS=high>high and high>er;// 平衡线上买入;
   

   if(HFX==true)

         PlotNumeric("上分形",HHFX,0,Yellow,3);//输出上分形的值

       

    If(MarketPosition == 0 and chi>chun)
   
        // 突破开仓
        If(High > HHFX and hhfx>chi)
        {
            
                    myEntryPrice = HHFX ;
            myEntryPrice = max(Open,myEntryPrice)+MinPoint; // 大跳空的时候用开盘价代替
            preEntryPrice = myEntryPrice;
            Buy(lots,myEntryPrice);
            SendOrderThisBar = True;
                        Commentary("分形买入");
    }

       
            If(MarketPosition==1 and   QY==true and close>closeand SendOrderThisBar==false and close>preEntryPrice+minpoint)
                  {
                   myEntryPrice= max(Open,PreEntryPrice)+MinPoint;
                   Buy(lots,myentryprice);
                   SendOrderThisBar=true;
                   Commentary("区域买入");
                   }
               
       
   If(MarketPosition == 1  and SendOrderThisBar==false and close>preEntryPrice+30*minpoint) // 有多仓的情况,加多仓
    {
      
        If(preEntryPrice!=InvalidNumeric )
               
                       
                If(High > HHFX and hhfx>chi and BarsSinceLastEntry>2 )  //突破分形加仓;
                {       
            myEntryPrice = HHFX ;
                myEntryPrice = max( Open,myEntryPrice)+MinPoint; // 大跳空的时候用开盘价代替
                preEntryPrice = myEntryPrice;
                Buy(lots,myEntryPrice);
                SendOrderThisBar = True;
                Commentary("分形加仓");
               
                }
         If(aodx==true or AOCY==true or aosf==true  and SendOrderThisBar==false)//AO加仓;
                if (high>high)
                   {myEntryPrice=Max(high,open)+MinPoint;
                        Buy(lots,myExitPrice);
                        SendOrderThisBar=true;
                       
                        Commentary("AO加仓");
                       
                        }
         if(ACS==true or AcX==true OR AcCY==true and SendOrderThisBar==false)//AC 加仓;
                       
         if (high>high and SendOrderThisBar==false)
                {myEntryPrice=Max(high,open)+MinPoint;
                 Buy(lots,myEntryPrice);
                 SendOrderThisBar=true;
                 Commentary("AC加仓");
                 
                 }
                          
         If(PHXX==true and high>high  and SendOrderThisBar==false )   
                {myEntryPrice=Max(high,open)+MinPoint;//平衡线下加仓
               
                Buy(lots,myEntryPrice);
                SendOrderThisBar=true;
                Commentary("平衡线下加仓");
               
                }       
               
               
               
     if        (PHXS==true and high>high and SendOrderThisBar==false)
                 
      {  myEntryPrice=Max(high,open)+MinPoint;//平衡线上加仓

        Buy(lots,myEntryPrice);       
                SendOrderThisBar=true;
                Commentary("平衡线上加仓");
                }
     }       

       
         if(MarketPosition == 1 and  SendOrderThisBar==false and  BarsSinceLastEntry>2)
     {  If(low<chi)
          
                {Sell(0,Min(open,chi)-minpoint);
                 Commentary("破齿线平仓");
                }
          

          
          
          
          
          
          
          
          
          
          
          
                }       

End

//以上系统仅写出了多头市场,在螺纹钢、铁矿石等相对较为活跃的品种表现较好!
//高手补全空头部分或发现什么问题后,请与我联系,分享源码,交流心得,也是对分享成果的尊重。
//由阳光雨露原创,QQ:5400958969
// 编译版本        GS2015.12.25
// 用户版本        2018/08/20 13:35:00
// 版权所有        zyqh100032595
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TradeBlazer公式修改和重写的权利
页: [1]
查看完整版本: 真正的鳄鱼线指标