Help with CopyBuffer

 
I am not getting access to the CopyBuffer data, I put buffer [0] or buffer [1] and it always returns me the same value or zero
double buffer[];
      int zig = iCustom(_Symbol,0,"Examples\\ZigZag");
      ArraySetAsSeries (buffer, true );
      
      CopyBuffer(zig,0,0,5,buffer);
      Print("Buffer 0: ",buffer[0]);
      Print("Buffer 1: ",buffer[1]);
What would I have to change so I could manipulate the buffer data?

 
Edilson Domingos:

Check your return values when creating a handle and on CopyBuffer().

Also, check the error log.

 
Edilson Domingos:
Zigzag has values only on local extermum bars, look for other bars dafa (not only zero) until an exteemum is found