icustom ZigZag - página 2

 
zig=icustom(NULL,0,'ZigZag',ExtDepth,ExtDeviation,ExtBackstop,2,i);
 
Eu também tenho um problema com o iCustom ZigZag...ele não me dá novos dados...permanecem no antigo.

Eu tenho esta função chamada desde o Start.

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, isto aconteceu em VIVO, não em testes... O que quer que eu faça, esse valor permanece preso...
Eu até modifiquei o . Tomei o indicador de uma versão anterior do MT4 e o fiz um BetterZigZag (o ziguezague na tela é um pouco diferente, mas isso não é por minha causa).
O Better Zig Zag retornou o mesmo valor, não importa o que aconteceu no gráfico mais adiante.
Inclui 4 buffers extras, 2 temporários (não necessários) e 2 utilizáveis, que representam os locais reais no tempo (ExtExtraBufferX, buffer 3; ExtExtraBufferY, buffer4).
Quando vi que o último valor ainda é o mesmo não importava se o indicador estava progredindo na tela, forcei as coisas até longe e coloquei o indicador para escrever o últimozig/zag local em 2 variáveis globais (A EA estava exigindo explicitamente que o indicador estivesse na tela). Isto também não funcionou. Eu anexei o código aqui:

//+------------------------------------------------------------------+
//|                                                 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)
  }
//+------------------------------------------------------------------+


Vejo problemas semelhantes no . O valor retornado não é como o que aparece na tela, no entanto, ele é alterado:

Eu chamei assim o SAR parabólico:

PSar=iCustom(NULL,0, "Parabólico",0.02,0.2,0,0);

O que eu recebo é isto:
 
c0d3:
Estou tentando determinar a direção do indicador de ziguezague com o comando icustom.

Isto é o que eu tenho até agora:

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

As linhas são desenhadas no gráfico, mas tanto ZigZagHigh quanto ZigZagLow são iguais tozero quando eu executo o programa.




Como eu determinaria a tendência do indicador ZigZag com a função icustom?


Obrigado
 
Hi

Vocês podem colocar os três ziguezagues tampão, por favor.

Obrigado
Dr. Gaines
 
dr_gaines:
c0d3:
Estou tentando determinar a direção do indicador de ziguezague com o comando icustom.



Isto é o que eu tenho até agora:



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

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



As linhas são desenhadas no gráfico, mas tanto ZigZagHigh quanto ZigZagLow são iguais tozero quando eu executo o programa.









Como eu determinaria a tendência do indicador ZigZag com a função icustom?





Obrigado



Não se pode determinar a tendência. A posição do último ponto é variável até que outro ponto seja adicionado.
 
dr_gaines:


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

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

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


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

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

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

我得到的是这:





Tempo>=M30

 

Tempo>M30

zigzag=betterzigzag

Razão: