Что не так с FileReadDouble (FileWriteDouble)?

 

Есть скрипт тестовый:

//+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
//|                                                                                                                                                         writeSpicifiedType.mq5 |
//|                                                                                                                                                                            hoz |
//|                                                                                                                                                                                |
//+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
#property copyright "hoz"
#property link      ""
#property version   "1.00"

/*
double high = 0;
double profit = 0;
double low = 0;
*/
double high = 1.3154;
double profit = 50;
double low = 1.3140;

//+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
//|                                                                                Script program start function                                                                   |
//+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
void OnStart() {
//---
  Print("_high = ", DoubleToString(high));
  Print("_profit = ", profit);
  Print("_low = ", low);
  loadSettings();
  saveSettings();
  Print("high = ", high);
  Print("profit = ", profit);
  Print("low = ", low);
}

//+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
//|                                                                                Expert Load setings function                                                                    |
//+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
void loadSettings(void) {
  string fileName = _Symbol + ".dat";
  int fileHandle;
//---
  if (FileIsExist(fileName, 0)) {
    fileHandle = FileOpen(fileName, FILE_READ|FILE_BIN);
    
    if (fileHandle != INVALID_HANDLE) {
      high = FileReadDouble(fileHandle);
      Print(__FUNCTION__, " high = ", high);
      profit = FileReadDouble(fileHandle);
      Print(__FUNCTION__, " profit = ", profit);
      low = FileReadDouble(fileHandle);
      Print(__FUNCTION__, " low = ", low);
      FileClose(fileHandle);
    }
  }
}
//+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
//|                                                                                Expert Save settings function                                                                   |
//+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
void saveSettings(void) {
  string fileName = _Symbol + ".dat";
  int fileHandle;
  bool fileFound = true;
//---  
  if (FileIsExist(fileName, 0)) {
    if (FileDelete(fileName, 0))
      fileFound = false;
  } else {
    fileFound = false;
  }
//---
  if (!fileFound) {
    fileHandle = FileOpen(fileName, FILE_WRITE|FILE_BIN);
    if (fileHandle != INVALID_HANDLE) {
      FileWriteDouble(fileHandle, high);
      FileWriteDouble(fileHandle, profit);
      FileWriteDouble(fileHandle, low);
      FileClose(fileHandle);
    }
  } 
}

В OnStart() поочерёдно вызываю loadSettings() и  saveSettings(), соответственно, для чтения данных и для записи данных. Всё элементарно и просто. Но почему-то при чтении данные не читаются. Как это понимать?

 

Вроде написал максимально подробный пример:

//+------------------------------------------------------------------+
//|                                           writeSpicifiedType.mq5 |
//|                                                              hoz |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "hoz"
#property link      ""
#property version   "1.00"
//---
double high=-1.0;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   Print("");
   ReadSettings();
   Print("read high   = ",DoubleToString(high,5));
   high=rand()/32767.0+1.0;
   Print("rand high   = ",DoubleToString(high,5));
   WriteSettings();
  }
//+------------------------------------------------------------------+
//| Read setings function                                            |
//+------------------------------------------------------------------+
void ReadSettings(void)
  {
   Print(__FUNCTION__);
   string fileName=_Symbol+".dat";
   int fileHandle;
//---
   if(FileIsExist(fileName,0))
     {
      Print("FileIsExist=true");
      fileHandle=FileOpen(fileName,FILE_READ|FILE_BIN);
      if(fileHandle!=INVALID_HANDLE)
        {
         Print("FileOpen=true");
         high=FileReadDouble(fileHandle);
         FileClose(fileHandle);
        }
      else
         Print("FileOpen=false");
     }
   else
      Print("FileIsExist=false");
  }
//+------------------------------------------------------------------+
//| Write settings function                                          |
//+------------------------------------------------------------------+
void WriteSettings(void)
  {
   Print(__FUNCTION__);
   string fileName=_Symbol+".dat";
   int fileHandle;
   bool fileFound=true;
//---  
   if(FileIsExist(fileName,0))
     {
      Print("FileIsExist=true");
      if(FileDelete(fileName,0))
        {
         Print("FileDelete=true");
         fileFound=false;
        }
      else
         Print("FileDelete=false");
     }
   else
     {
      Print("FileIsExist=false");
      fileFound=false;
     }
//---
   if(!fileFound)
     {
      Print("fileFound=false");
      fileHandle=FileOpen(fileName,FILE_WRITE|FILE_BIN);
      if(fileHandle!=INVALID_HANDLE)
        {
         Print("FileOpen=true");
         FileWriteDouble(fileHandle,high);
         FileClose(fileHandle);
        }
      else
         Print("FileOpen=false");
     }
   else
      Print("fileFound=true");
  }
//+------------------------------------------------------------------+


И результат (три запуска, перед первым запуском файла ещё нет)

ReadSettings
FileIsExist=false
read high   = -1.00000
rand high   = 1.92523
WriteSettings
FileIsExist=false
fileFound=false
FileOpen=true

ReadSettings
FileIsExist=true
FileOpen=true
read high   = 1.92523
rand high   = 1.09458
WriteSettings
FileIsExist=true
FileDelete=true
fileFound=false
FileOpen=true

ReadSettings
FileIsExist=true
FileOpen=true
read high   = 1.09458
rand high   = 1.61129
WriteSettings
FileIsExist=true
FileDelete=true
fileFound=false
FileOpen=true
Файлы:
Test_en.mq5  6 kb
 
Хз. Перегрузил терминал и всё теперь работает. Глюкануло видимо случайно. Вопрос снят.
Причина обращения: