Download MetaTrader 5
To add comments, please log in or register
Have you found an error in our products? Apply to Service Desk!
Laurentiu Sorin Tene
692
Laurentiu Sorin Tene 2016.10.15 08:29 


I have a newbie question about coding. As you see on below picture I attached 2 ZigZag indicator to a chart. First with parameter Deviation=1000 color white and second with Deviation=5 color red. As you see there is not influence of Deviation parameter (indicators are overlapped).

 

 I looked at the source code and saw these lines:

//--- main loop      
   for(i=limit; i>=0; i--)
     {
      //--- find lowest low in depth of bars
      extremum=low[iLowest(NULL,0,MODE_LOW,InpDepth,i)];
      //--- this lowest has been found previously
      if(extremum==lastlow)
         extremum=0.0;
      else 
        { 
         //--- new last low
         lastlow=extremum; 
         //--- discard extremum if current low is too high
         if(low[i]-extremum>InpDeviation*Point)
            extremum=0.0;
         else
           {
            //--- clear previous extremums in backstep bars
            for(back=1; back<=InpBackstep; back++)
              {
               pos=i+back;
               if(ExtLowBuffer[pos]!=0 && ExtLowBuffer[pos]>extremum)
                  ExtLowBuffer[pos]=0.0; 
              }
           }
        } 
      //--- found extremum is current low
      if(low[i]==extremum)
         ExtLowBuffer[i]=extremum;
      else
         ExtLowBuffer[i]=0.0;
      //--- find highest high in depth of bars
      extremum=high[iHighest(NULL,0,MODE_HIGH,InpDepth,i)];
      //--- this highest has been found previously
      if(extremum==lasthigh)
         extremum=0.0;
      else 
        {
         //--- new last high
         lasthigh=extremum;
         //--- discard extremum if current high is too low
         if(extremum-high[i]>InpDeviation*Point)
            extremum=0.0;
         else
           {
            //--- clear previous extremums in backstep bars
            for(back=1; back<=InpBackstep; back++)
              {
               pos=i+back;
               if(ExtHighBuffer[pos]!=0 && ExtHighBuffer[pos]<extremum)
                  ExtHighBuffer[pos]=0.0; 
              } 
           }
        }
      //--- found extremum is current high
      if(high[i]==extremum)
         ExtHighBuffer[i]=extremum;
      else
         ExtHighBuffer[i]=0.0;
     }

I do not understand why this parameter has no influence on the chart. Please basic explanation. I am newbie at coding/

Thanks in advance!

PS It is a built in indicator in MT4 software.
 

Laurentiu Sorin Tene
692
Laurentiu Sorin Tene 2016.11.07 10:20  
I want to thanks to @FMIC for his answer to my subject, and to notify that reply can not be done anymore on MQL4 forum, that is why I've done it here.
Laurentiu Sorin Tene
692
Laurentiu Sorin Tene 2016.10.18 06:58  
So nobody interested about this subject ?
Laurentiu Sorin Tene
692
Laurentiu Sorin Tene 2016.10.26 08:04  
OK, maybe someone knows another forum/site where I can find the answer.....
Ovo Cz
2954
Ovo Cz 2016.10.26 09:58  
tenlau:
OK, maybe someone knows another forum/site where I can find the answer.....

Yes there are many. If you look for zigzag logic, start here: https://www.mql5.com/en/articles/646 

Fernando Carreiro
1429
Fernando Carreiro 2016.10.30 15:57  
tenlau: I have a newbie question about coding. As you see on below picture I attached 2 ZigZag indicator to a chart. First with parameter Deviation=1000 color white and second with Deviation=5 color red. As you see there is not influence of Deviation parameter (indicators are overlapped).

Sorry for the late post, but I have recently been looking at the ZigZag code again, and it seems that you are correct. There is in fact a bug in the code with respect to the deviation that has never been corrected.

Here is a discussion, entitled "ZigZag is NOT ZigZag!" on this and other bugs detected in the MT4 version of ZigZag and derivations (including my own ZigZagZug which suffers from the same bug):

  • http://www.stevehopwoodforex.com/phpBB3/viewtopic.php?f=15&t=1313
@Moderator: I hope this URL is acceptable in accordance with the Forum rules, because it is not an advertisement but a Forum site with information on this matter.
/
To add comments, please log in or register