Download MetaTrader 5

Error in finding highest volume

To add comments, please log in or register
Richard
60
Richard  

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.

Fernando Carreiro
3868
Fernando Carreiro  
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
Richard
60
Richard  
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.

To add comments, please log in or register