English

## Trouble understanding ArrayMaximum () function?

 52 renzbub 2015.06.03 18:54   Im trying to write a short code that finds the highest value of iStochastic from the last 3 bars using the ArrayMaximum () function.```void OnInit() {      double s1 = iStochastic(_Symbol,_Period,KPeriod,DPeriod,Slowing,StochMethod,StochPrice,MODE_MAIN,0);    double s2 = iStochastic(_Symbol,_Period,KPeriod,DPeriod,Slowing,StochMethod,StochPrice,MODE_MAIN,1);    double s3 = iStochastic(_Symbol,_Period,KPeriod,DPeriod,Slowing,StochMethod,StochPrice,MODE_MAIN,2);           double num_array[3]={s1,s2,s3};      int maxValueIdx=ArrayMaximum(num_array,WHOLE_ARRAY,0);       double high = iHigh(NULL,0,maxValueIdx);        datetime time = iTime(NULL,0,maxValueIdx);           bool line1 = ObjectCreate("Thumb",OBJ_ARROW_THUMB_UP,0,time,high); } ```I have tried to assign each object but the array doesn't understand the objects.So here i'm stuck on figuring how I get ArrayMaximum () function to understand the iStochastic values.
 Moderator3206 angevoyageur 2015.06.03 19:52 #   Don't place this code in OnInit().```   double num_array[3];    for(int i=0;i<3;i++)      {       num_array[i]=iStochastic(_Symbol,_Period,KPeriod,DPeriod,Slowing,StochMethod,StochPrice,MODE_MAIN,i);      }    int maxValueIdx=ArrayMaximum(num_array,WHOLE_ARRAY,0);    double high=iHigh(NULL,0,maxValueIdx);    datetime time=iTime(NULL,0,maxValueIdx);    bool line1=ObjectCreate("Thumb",OBJ_ARROW_THUMB_UP,0,time,high); ```
 12985 WHRoeder 2015.06.03 20:34 #   ` double num_array[3]={s1,s2,s3};`Only initializing with constants can use that form.