why this Array get zero?

 

Hi,

I wrote a code, for trial purpose, which:

1>, draw a line showing zigzag swing high/low price,

2>, and print out price of peak1, peak2, peak3 and peak4 (from right to left).

The code is like:

......
   for(int i=0; i<limit; i++)
   {
   ExtBuffer[i]=iCustom(NULL,0,"ZigZag",.....,i);
   }

int k=0; 
int peakcount=0;  
double peaks[];
   while(peakcount<5)
   {
   if(ExtBuffer[k]>0.5)
     {
     peakcount++;
     peaks[peakcount]=ExtBuffer[k];
     }
   k++;
   }  
     
Print("pk1=",peaks[1],"----pk2=",peaks[2],"----pk3=",peaks[3],"----pk4=",peaks[4]);  
......

Now step 1> works fine,(when not swing peak, value is 0), but step 2> always gives me zero for all 4 pk price.

Somebody, please give me a hand. Is it related to Array?

 

double peaks[];
ArrayResize(peaks, 5);

 
DxdCn:

double peaks[];
ArrayResize(peaks, 5);


Thanks !!!

Have a good day!

Reason: