Error in finding highest volume

 

Hi everybody,

I am new to coding and need help to find the highest volume but keeps getting error message "possible loss of data due to type conversion".


double hiVolume;

   int val_index = iHighest(NULL,0,MODE_VOLUME,20,2);

   if (val_index!=-1) hiVolume = Volume[val_index];

Can anybody point out where is the mistake and how to correct it?

Thanks a lot.

 
Richard: I am new to coding and need help to find the highest volume but keeps getting error message "possible loss of data due to type conversion". Can anybody point out where is the mistake and how to correct it?
double hiVolume;
int val_index = iHighest(NULL,0,MODE_VOLUME,20,2);
if (val_index!=-1) hiVolume = Volume[val_index];

The predefined variable Volume[] is defined as "long", not a "double".

Get into the habit of always checking the documentation when you get Warnings, Errors or in general when coding!

Also, please use the SRC button when adding code to posts.

Volume - Predefined Variables - MQL4 Reference
Volume - Predefined Variables - MQL4 Reference
  • docs.mql4.com
Volume - Predefined Variables - MQL4 Reference
 
Fernando Carreiro:

The predefined variable Volume[] is defined as "long", not a "double".

Get into the habit of always checking the documentation when you get Warnings, Errors or in general when coding!

Also, please use the SRC button when adding code to posts.


Fernando,

Thank you for pointing out my mistakes. I appreciate your help.

Reason: