title: How to get several Zigzag highs and lows form UNIVERSAL ZIGZAG expert, MQL5?
body: <p>As you know <a href="https://www.mql5.com/en/articles/2774" rel="nofollow noreferrer">UNIVERSAL ZIGZAG</a> is a complete Zigzag expert and indicator.
  We can call it as below in our expert:</p>
  <pre><code>int handle=iCustom(Symbol(),Period(),&quot;iUniZigZagSW&quot;,SrcSelect,
                 DirSelect,
                 RSIPeriod,
                 RSIPrice,
                 MAPeriod,
                 MAShift,
                 MAMethod,
                 MAPrice,
                 CCIPeriod,
                 CCIPrice,
                 ZZPeriod);
  </code></pre>
  <p>And by these couple of lines of code we can get the last high an low of zigzag:</p>
  <pre><code>double lhb[], zz[];
  if(CopyBuffer(handle,4,0,**1**,lhb)&lt;=0)
       {
        Print(&quot;Error obtaining data from the ZigZag 2&quot;);
        return;
       }
     // index of the bar when counting to the right of zero
     ind=bars-(int)lhb[0]-1;
  
     // value of the ZigZag at the ind bar
     if(CopyBuffer(handle,2,ind,**1**,zz)&lt;=0)
       {
        Print(&quot;Error obtaining data from the ZigZag 3&quot;);
        return;
       }
       ...
  </code></pre>
  <p>As I have bold the 1 number, those are count of highs that we want to know.</p>
  <p><strong>The question is, how can I get last 3 or more highs or lows of Zigzag?</strong></p>
  <p>Even if increase the count of array in the <code>CopyBuffer(handle,4,0,**1**,lhb)</code> the result wont be correct.</p>
  <p>The <code>CopyBuffer(handle,2,ind,1..X,zz)</code> returns incorrect number or just the last high or low of Zigzag.</p>