Download MetaTrader 5

Im reading a double from an excel is returning an int?

To add comments, please log in or register
Sell products via the Market and track your sales statistics
Luis
226
Luis 2015.05.08 18:24 

Hello there, Im having a bit of trouble here:


double Read_File(int i)
   {
      int handle=FileOpen(Archivo_Historical(),FILE_READ|FILE_CSV);
      while(Time[i]!=FileReadString(handle) && !FileIsEnding(handle))
         FileReadString(handle);
      int valor=StrToDouble(FileReadString(handle));
      FileClose(handle);
      return valor;

   }


Im reading values like 52.2,  90.3, etc....  but Im receiving them like 52.0 and 90.0 My excel uses "." and not "," as a decimal point. Maybe this is a clue of what could be happening.


Could you help me?


Thank you.

honest_knave
Moderator
2216
honest_knave 2015.05.08 20:55  
double Read_File(int i)
   {
      int handle=FileOpen(Archivo_Historical(),FILE_READ|FILE_CSV);
      while(Time[i]!=FileReadString(handle) && !FileIsEnding(handle))
         FileReadString(handle);
//      int valor=StrToDouble(FileReadString(handle));
      double valor=StrToDouble(FileReadString(handle));
      FileClose(handle);
      return valor;

  }
Luis
226
Luis 2015.05.09 12:10  

Oh my...

I think Im more retarded everyday.

Thank you soo much for pointing the error!

honest_knave
Moderator
2216
honest_knave 2015.05.09 12:27  
Don't worry, I think we've all done that at some point! Or something similar.
To add comments, please log in or register