梦丫头 发表于 2020-11-22 16:13:37

ZigZagFirst




//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#property link      "http://www.eazhijia.com"
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//+------------------------------------------------------------------+
//|                                        Custom Moving Average.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       
//+------------------------------------------------------------------+
#property copyright      "Ex4 to Mq4 decompiler v3.91"
#property link      "http://www.eazhijia.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 White
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers(2);
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(0,0.0);
   ArraySetAsSeries(ExtMapBuffer,true);
   ArraySetAsSeries(ExtMapBuffer2,true);
//---- indicator short name
   IndicatorShortName("ZigZagFirstBar("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")");
//---- initialization done
   return(0);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
{
   int    shift, back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;

   for(shift=Bars-ExtDepth; shift>=0; shift--)
   {
      val=Low;
      if(val==lastlow) val=0.0;
      else
      {
         lastlow=val;
         if((Low-val)>(ExtDeviation*Point)) val=0.0;
         else
         {
            for(back=1; back<=ExtBackstep; back++)
            {
               res=ExtMapBuffer;
               if((res!=0)&&(res>val)) continue;//ExtMapBuffer=0.0;
            }
         }
      }
      ExtMapBuffer=val;
      //--- high
      val=High;
      if(val==lasthigh) val=0.0;
      else
      {
         lasthigh=val;
         if((val-High)>(ExtDeviation*Point)) val=0.0;
         else
         {
            for(back=1; back<=ExtBackstep; back++)
            {
               res=ExtMapBuffer2;
               if((res!=0)&&(res=0; shift--)
   {
      curlow=ExtMapBuffer;
      curhigh=ExtMapBuffer2;
//      if((curlow==0.0)||(curhigh==0.0)) continue;
      //---
      if(curhigh!=0)
      {
         if(lasthigh>0)
         {
            if(lasthigh0)
         {
            if(lastlow>curlow) ExtMapBuffer=0;
            else ExtMapBuffer=0;
         };//z
         //---
         if((curlow=0; shift--)
   {
      if(shift>=Bars-ExtDepth) ExtMapBuffer=0.0;
      else
      {
         res=ExtMapBuffer2;
         if(res!=0.0) ExtMapBuffer=res;
         //if(res>0.0) ExtMapBuffer=res;
      }
   }
}




hnjzwyc 发表于 2020-12-3 13:37:46

谢谢

wxrduu 发表于 2020-12-9 13:21:34

{:1_179:}

白姬拒 发表于 2020-12-19 12:09:21

谢谢

dadaxing 发表于 2020-12-25 21:26:59

{:1_181:}

天气do不错 发表于 2021-1-4 20:56:32

谢谢

0523yh 发表于 2021-1-6 12:03:44

{:1_181:}

glqtqobq 发表于 2021-1-10 21:16:23

顶下

特工队长 发表于 2021-1-13 13:20:06

支持下

kingkinder 发表于 2021-1-20 10:21:19

顶下
页: [1] 2 3 4 5
查看完整版本: ZigZagFirst