icustom ZigZag - página 2

 
zig=icustom(NULL,0,'ZigZag',ExtDepth,ExtDeviation,ExtBackstop,2,i);
 
Yo también tengo un problema con iCustom ZigZag...no me da datos frescos...se queda atascado en los antiguos.

Tengo esta función llamada desde Inicio.

double FindClosestZZ()
  {
  int i;
  double zzh;
  for (i=0;i<1000;i++)
    {
    zzh=iCustom(Symbol(),Period(),"ZigZag",12,5,3, 0, i); 
    if (zzh!=0)
      return(zzh);
    }
  return(0);
  }
 
Rosh, esto ocurrió en LIVE, no en las pruebas... Haga lo que haga, ese valor sigue atascado. ...
Incluso he modificado el . Tomé el indicador de una versión anterior de MT4 y lo convirtió en un BetterZigZag (el zigzag en la pantalla es un poco diferente, pero eso no es por mí).
El Better Zig Zag devuelve el mismo valor, sin importar lo que ocurra en el gráfico más adelante.
Incluye 4 buffers extra, 2 temporales (no necesarios) y 2 utilizables, que representan las ubicaciones reales en el tiempo (ExtExtraBufferX, buffer 3 ; ExtExtraBufferY, buffer 4).
Cuando vi que el último valor seguía siendo el mismo sin importar que el indicador avanzara en pantalla, forcé las cosas aún más y puse el indicador a escribir la última ubicación del zig/zag en 2 variables globales (El EA requería explícitamente que el indicador estuviera en pantalla). Esto tampoco funcionó. Adjunto el código aquí:

//+------------------------------------------------------------------+
//|                                                 BetterZigZag.mq4 |
//+------------------------------------------------------------------+
 
 
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtLowBuffer[];
double ExtHighBuffer[];
double ExtExtraBufferX[];
double ExtExtraBufferY[];
double ExtTempBufferX[];
double ExtTempBufferY[];
 
int extrapos=0;
 
int Round(double i)
    {
    string s;
    int res;
    s=DoubleToStr(i,0);
    res=StrToInteger(s);
    return(res);
    }
    
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {   
   IndicatorBuffers(7);   
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexBuffer(1,ExtLowBuffer);
   SetIndexBuffer(2,ExtHighBuffer);
   SetIndexBuffer(3,ExtExtraBufferX);
   SetIndexBuffer(4,ExtExtraBufferY);
   SetIndexBuffer(5,ExtTempBufferX);
   SetIndexBuffer(6,ExtTempBufferY);   
   SetIndexEmptyValue(0,0.0);
//---- indicator short name
   IndicatorShortName("BetterZigZag("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    shift, back,lasthighpos,lastlowpos,index;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;
//----
   for(shift=Bars-ExtDepth; shift>=0; shift--)
     {
      index=Lowest(NULL,0,MODE_LOW,ExtDepth,shift);
      val=Low[index];
      if(val==lastlow) val=0.0;
      else 
        { 
         lastlow=val; 
         if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back<=ExtBackstep; back++)
              {
               res=ExtLowBuffer[shift+back];
               if((res!=0)&&(res>val)) ExtLowBuffer[shift+back]=0.0; 
              }
           }
        } 
      ExtLowBuffer[shift]=0.0;
      if(val!=0.0) ExtLowBuffer[index]=val;
      //--- high
      index=Highest(NULL,0,MODE_HIGH,ExtDepth,shift);
      val=High[index];
      if(val==lasthigh) val=0.0;
      else 
        {
         lasthigh=val;
         if((val-High[shift])>(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back<=ExtBackstep; back++)
              {
               res=ExtHighBuffer[shift+back];
               if((res!=0)&&(res<val)) ExtHighBuffer[shift+back]=0.0; 
              } 
           }
        }
      ExtHighBuffer[shift]=0.0;
      if(val!=0.0) ExtHighBuffer[index]=val;
     }
//---- final cutting 
   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;
 
   for(shift=Bars-ExtDepth; shift>=0; shift--)
     {
      curlow=ExtLowBuffer[shift];
      curhigh=ExtHighBuffer[shift];
      if(curlow==0 && curhigh==0) continue;
      //---
      if(curhigh!=0)
        {
         if(lasthigh>0) 
           {
            if(lasthigh<curhigh) ExtHighBuffer[lasthighpos]=0;
            else ExtHighBuffer[shift]=0;
           }
         //---
         if(lasthigh<curhigh || lasthigh<0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           }
         lastlow=-1;
        }
      //----
      if(curlow!=0)
        {
         if(lastlow>0)
           {
            if(lastlow>curlow) ExtLowBuffer[lastlowpos]=0;
            else ExtLowBuffer[shift]=0;
           }
         //---
         if((curlow<lastlow)||(lastlow<0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           } 
         lasthigh=-1;
        }
     }
//---- merge 2 buffers
   lasthighpos=-1;
   lastlowpos=-1;
   for(shift=Bars-1; shift>=0; shift--)
     {
      if(shift>=Bars-ExtDepth) 
        {
         ExtMapBuffer[shift]=0.0;
         ExtTempBufferX[shift]=0.0;
         ExtTempBufferY[shift]=0.0;         
         ExtExtraBufferX[shift]=0.0;
         ExtExtraBufferY[shift]=0.0;
        }
      else
        {
         curlow=ExtLowBuffer[shift];
         curhigh=ExtHighBuffer[shift];
         //----
         res=0;
         if(curlow!=0)
           {
            if(lastlowpos==-1)
              {
               res=curlow;
               lastlowpos=shift;
              }
            else
              {
               if(lasthighpos!=-1 && lastlowpos>lasthighpos)
                 {
                  res=curlow;
                  lastlowpos=shift;
                 }
              }
           }
         if(curhigh!=0)
           {
            if(lasthighpos==-1)
              {
               res=curhigh;
               lasthighpos=shift;
              }
            else
              {
               if(lastlowpos!=-1 && lasthighpos>lastlowpos)
                 {
                  res=curhigh;
                  lasthighpos=shift;
                 }
              }
           }
         //----
         ExtMapBuffer[shift]=res;
         if (res!=0&&shift<10000000)
           {            
            ExtTempBufferX[extrapos]=shift;
            ExtTempBufferY[extrapos]=res;
            extrapos=extrapos+1;
           }
        }
     }
     
  //arranging extras
  if (ExtTempBufferX[extrapos]>10000000)
    {
     extrapos=extrapos-1;
    }    
  if (extrapos>=0&&extrapos!=1)
    {    
    int maxpos=extrapos;   
    int final;
    bool addmid=false;
    double swap=0; 
    if (extrapos/2==Round(extrapos/2))
      {
      final=Round(extrapos/2)-1;
      addmid=True;
      }
    else
      {
       final=Round(extrapos/2);
       addmid=false;
      }
    for (int xscan=0;xscan<=final;xscan++)
       {
        swap=ExtTempBufferY[xscan];
        ExtExtraBufferY[xscan]=ExtTempBufferY[maxpos];
        ExtExtraBufferY[maxpos]=swap;
        swap=ExtTempBufferX[xscan];
        ExtExtraBufferX[xscan]=ExtTempBufferX[maxpos];
        ExtExtraBufferX[maxpos]=swap;        
        maxpos=maxpos-1;
       }
    if (addmid==true)
      {
       ExtExtraBufferX[final+1]=ExtTempBufferX[final+1];
       ExtExtraBufferY[final+1]=ExtTempBufferY[final+1];
      }
    GlobalVariableSet("ClosestZigZagX",ExtExtraBufferX[0]);
    GlobalVariableSet("ClosestZigZagY",ExtExtraBufferY[0]);
    maxpos=extrapos;    
    }//if (extrapos!=0&&extrapos!=1)
  }
//+------------------------------------------------------------------+


Veo problemas similares en el . El valor devuelto no es como el de la pantalla, sin embargo se modifica:

Llamé al SAR Parabólico así:

PSar=iCustom(NULL,0, "Parabolic",0.02,0.2,0,0);

Lo que obtengo es lo siguiente
 
c0d3:
Estoy tratando de determinar la dirección del indicador de zigzag con el comando icustom.

Esto es lo que tengo hasta ahora

ZigZagHigh=iCustom(NULL,0, "ZigZag",MODE_HIGH,0);
ZigZagLow=iCustom(NULL,0, "ZigZag",MODE_LOW,0);

Las líneas se dibujan en el gráfico, pero tanto ZigZagHigh como ZigZagLow son iguales a cero cuando ejecuto el programa.




¿Cómo puedo determinar la tendencia del indicador ZigZag con la función icustom?


Gracias
 
Hola

Podéis postear el zigzag de tres buffers por favor.

Gracias
Dr. Gaines
 
dr_gaines:
c0d3:
Estoy tratando de determinar la dirección del indicador de zigzag con el comando icustom.



Esto es lo que tengo hasta ahora



ZigZagHigh=iCustom(NULL,0, "ZigZag",MODE_HIGH,0);

ZigZagLow=iCustom(NULL,0, "ZigZag",MODE_LOW,0);



Las líneas se dibujan en el gráfico, pero tanto ZigZagHigh como ZigZagLow son iguales a cero cuando ejecuto el programa.









¿Cómo puedo determinar la tendencia del indicador ZigZag con la función icustom?





Gracias



No se puede determinar la tendencia. La posición del último punto es variable hasta que se añade otro punto.
 
dr_gaines:


能你们请张贴 3缓冲区之字形。

感谢
盖恩斯博士
Archivos adjuntos:
zigzag_1.mq4  7 kb
 
TheEconomist:
Rosh, 这发生了在上生动, 不测试... 我做无论什么, 那价值留下粘住...
我甚至更改了之字形。 从MT4的一个先前的版本拿了指示物并且使它成为了一BetterZigZag(在屏幕上的之字形是一点的不同, 但是那不因为我)。
好一些的转弯急变归还了一样的价值, 不管在图表上什么进一步发生了。
它包括4个额外的缓冲区, 2暂时(不necesario) 并且2合用, 它准时代表实际的地点(ExtExtraBufferX, 缓冲区3; ExtExtraBufferY, 缓冲区4)。
当我看了时最后价值仍然是一样的不管指示物在屏幕上正在进行, 我甚至远强迫了事情并且我把指示物放在2全球的变数写最后转弯/急变地点(EA是明析地要求指示物在屏幕上)。 也这没工作。 我这里依附代码:

//+------------------------------------------------------------------+
//|                                                 BetterZigZag.mq4|
//+------------------------------------------------------------------+
 
 


在比喻的SAR上我看相似的问题。 归还的价值不是在屏幕上喜欢一个, 它然而得到改变:

我叫了比喻的SAR象一样这:

PSar=iCustom(0,0,“比喻”,0.02,0.2,0,0);

我得到的是这:





Hora>=M30

 

Tiempo>M30

zigzag=mejorzigzag