ArrayMaximum Returns -1

 

Hi,I'm trying to get the highest value from array but i'm receiving -1 when using ArrayMaximum

CopyHigh it's filling the array correctly

You can see the values of the array and the code :

Code

Any opinion why i'm getting this error ? 
Thanks for the attention !

 
ArrayMaximum(Valores); // WHOLE_ARRAY
 
fxsaber:
Wow ! It's Working now ! Thanks @fxsaber
 
  1. Please don't post images of code or messages, copy and paste using the CODE button (Alt-S)
  2. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
    In your case you are normalizing, already normalized values.

  3. int tipo_op,
    if(tipo_op == 0)
    if(tipo_op == 1)
    Don't hard code constants. Write self-documenting code, use the proper constants.
 
whroeder1:
  1. Please don't post images of code or messages, copy and paste using the CODE button (Alt-S)
  2. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
    In your case you are normalizing, already normalized values.

  3. Don't hard code constants. Write self-documenting code, use the proper constants.

Thanks,i appreciate the points you said and i 'll look better to fix it. Thanks !!!

 
Bilal Said:

Hi,I'm trying to get the highest value from array but i'm receiving -1 when using ArrayMaximum

CopyHigh it's filling the array correctly

And what will happen when it's not the case ?

You can see the values of the array and the code :

Any opinion why i'm getting this error ? 
Thanks for the attention !

Always check the return value of a function and process it. 

With mql5, the second parameter is "start" index, not count, please check the documentation.

 
Alain Verleyen:

And what will happen when it's not the case ?

Always check the return value of a function and process it. 

With mql5, the second parameter is "start" index, not count, please check the documentation.


Yes sir thank you for the advices!