And by these couple of lines of code we can get the last high an low of zigzag:
double lhb[], zz[];
if(CopyBuffer(handle,4,0,**1**,lhb)<=0)
{
Print("Error obtaining data from the ZigZag 2");
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 barif(CopyBuffer(handle,2,ind,**1**,zz)<=0)
{
Print("Error obtaining data from the ZigZag 3");
return;
}
...
As I have bold the 1 number, those are count of highs that we want to know.
The question is, how can I get last 3 or more highs or lows of Zigzag?
Even if increase the count of array in the CopyBuffer(handle,4,0,**1**,lhb) the result wont be correct.
The CopyBuffer(handle,2,ind,1..X,zz) returns incorrect number or just the last high or low of Zigzag.
ZigZag is one of the most popular indicators among the MetaTrader 5 users. The article analyzes the possibilities for creating various versions of the ZigZag. The result is a universal indicator with ample opportunities to extend its functionality, which is useful in the development of trading experts and other indicators.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
As you know UNIVERSAL ZIGZAG is a complete Zigzag expert and indicator. We can call it as below in our expert:
And by these couple of lines of code we can get the last high an low of zigzag:
As I have bold the 1 number, those are count of highs that we want to know.
The question is, how can I get last 3 or more highs or lows of Zigzag?
Even if increase the count of array in the CopyBuffer(handle,4,0,**1**,lhb) the result wont be correct.
The CopyBuffer(handle,2,ind,1..X,zz) returns incorrect number or just the last high or low of Zigzag.