How to extract data out of zigzag indicator in MQL5?

 

Hello,

maybe someone can help me with extraction of data from ZigZag indicator?

I tried this, and it gives Handle=10, bf=-1. zig=0, zag=0.

double            array[];                                                 //data array
double            bf;                                                      //candle count
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
   {
   i=0;
   n=0;
   Handle=iCustom(NULL,0,"Examples\\ZigZag",InpDepth,InpDeviation,InpBackstep);
   bf=CopyBuffer(Handle,0,0,1000,array);
   while(n<2)
      {
      if(zig>0) zag=zig;
      zig=array[i];
      if(zig>0) n+=1;
      i++;
      }

 


 
What the documentation is saying about CopyBuffer() returning -1 ?
 
Alain Verleyen:
What the documentation is saying about CopyBuffer() returning -1 ?

it say the data is not here yet:)

now it works fine.... almost fine... very slow :(

but THANKS anyway ;) 

 
Have you get this worrking? 
I used this attacched, it was working fine before, but now only get Daily chart even if i have the symbol open in H1.
Do you know why?