How to find the peak value of analog signal?
See if I understand this correctly: For a given time period you want to find the peak. 

void setup()
{
  unsigned long int cur_time = 0 ;
  unsigned long int time_elapsed = 0;
  int peaks[20]; // say you want to find 20 peaks , 1 peak for data arriving between 5 secs
  int time_period = 5000;  
  int data = 0; 
  int mx=0;
}

void loop()
{
   for(int i = 0 ; i&lt;20;i++)
   { 
      cur_time = millis();
      while(cur_time - time_elapsed &lt;=time_period)
      { 
             if(mx==0)
              { mx = analogRead(A0); } 
              else:
               {  data = analogread(A0);
                  mx = max(data , mx);  
               }
              cur_time = millis();
        } 
         time_elapsed = cur_time;
         peaks[i] = mx;
         mx = 0; 
        }
  }  


Hope this helps!!