error in zigzag output

 
I write a script to print zigzag point in windows

double Buf_0[],Buf_1[]; // 
//--------------------------------------------------------------------

//--------------------------------------------------------------------
int start() //  
{
int i, //  
Counted_bars;
double zz[] ; //  
//--------------------------------------------------------------------
Counted_bars=IndicatorCounted(); // 
i=Bars-Counted_bars-1; //  
if(Counted_bars < 0)
return(-1);
while(i>=0) //  
{
Buf_0[i]=High[i]; // 
Buf_1[i]=Low[i]; //
zz[i] = iCustom(Symbol(), 0, "ZigZag", 12, 5, 3, 1, i);
i--;

Print((string)i+" "+(string)zz[i]);
}
//--------------------------------------------------------------------
return(0); 
}



but result is : 2020.12.08 00:26:28.344 userindicator (1) SP500m,      H4: 205 0


that zigzag value always equal zero .


what is my error in zigzag output?


thank you for replying. god bless you


 i want to find 5 junction points based on zigzag function.

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code properly in a new post.
 
MatlabCoder98:
that zigzag value always equal zero .

what is my error in zigzag output?

It is always (usually?) zero on bar zero. Look at your complete output and find the last bar with a non-zero value.

Reason: