MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  File functions  FileWriteDouble

 
Use the opportunities of
MQL5 in MetaTrader 5
Study the new MQL5 language
Study the new MQL5 language.
Reference is already available
int FileWriteDouble( int handle, double value, int size=DOUBLE_VALUE)
The function writes a double value with floating point to a binary file. If the format is specified as FLOAT_VALUE, the value will be written as a 4-bytes floating point number (of the float type), otherwise, it will be written in the 8-bytes floating point format (of the double type).
Returns the actually written bytes count or a negative value if an error occurs.
To get the detailed error information, one has to call the GetLastError() function.
Parameters:
handle   -   File handle returned by the FileOpen() function.
value   -   Double precision value.
size   -   Optional format flag. It can be any of the following values:
DOUBLE_VALUE (8 bytes, default)
FLOAT_VALUE (4 bytes).
Sample:
  int handle;
  double var1=0.345;
  handle=FileOpen("mydata.dat", FILE_BIN|FILE_WRITE);
  if(handle<1)
    {
     Print("can't open file error-",GetLastError());
     return(0);
    }
  FileWriteDouble(h1, var1, DOUBLE_VALUE);
  //...
  FileClose(handle);