오류 코드 5004 - 페이지 4

 
samoye : 오류 5004에 대한 해결책이 있습니까? 파일에 쓰려고 하면 동일한 오류 메시지가 나타납니다.
묻고 답 했습니다. 루프 전에 파일 을 한 번 엽니다. 루프 파일을 닫습니다.
 

오류 5004는 파일을 닫지 않는 것과 관련이 있는 것 같습니다!


 int readFileImg ( string file_name) {

   int filehandle = FileOpen (file_name, FILE_READ | FILE_BIN );

   if (filehandle!= INVALID_HANDLE ) {

       FileClose (filehandle);   // this line is important, without this line you will get 5004

       Alert ( "done" );

   } else Alert ( "Operation FileOpen failed, error " , GetLastError (), TerminalInfoString ( TERMINAL_DATA_PATH ));

   return filehandle;

}

 

</> 버튼을 사용하여 코드를 삽입하십시오.


 

Strategy Tester 를 사용하여 EA를 테스트하는 동안 동일한 5004 오류가 나타납니다. 같은 세션에서 다른 파일을 열 수 있지만 갑자기 파일을 열 수 없기 때문에 mt4의 버그임에 틀림없습니다.

저는 이것을 기계 학습 알고리즘을 백테스트하는 데 사용합니다.

이제 mt4가 작동하지 않기 때문에 알고리즘을 백테스트하기 위한 다른 플랫폼이 필요합니다.

다른 백테스팅 플랫폼에 대한 아이디어가 있습니까?

가급적이면 파이썬 기반.

 
MT5를 사용해보십시오.
 
kypa :
MT5를 사용해 보세요.

내 프로그램을 디버그하려고 하는데 동일한 문제가 있습니다.

FileOpen Docs의 예제를 기반으로 파일에서 기호 목록을 읽는 이 함수 를 만들었습니다.

편집기의 "파일 디렉토리"에 파일을 포함하고 다음과 같이 함수를 호출합니다.


GetSymbolsFromFile( "carteiras" , "ibrx_100_2018_12_10.txt" );
//+------------------------------------------------------------------+
//| Get the symbols                                                  |
//+------------------------------------------------------------------+
void TProgram::GetSymbolsFromFile( const string filePath, const string fileName)
{
   //--- additional variables 
   int     str_size; 
   string str;
   int     array_size;
   string terminal_data_path;
   
   //--- open the file 
   ResetLastError (); 
   //--- Release the symbol array
   :: ArrayFree (m_file_symbols);
   
   terminal_data_path= TerminalInfoString ( TERMINAL_DATA_PATH );
   PrintFormat ( "File path: %s\\Files\\" ,terminal_data_path);
   
   bool   test1 = FileIsExist (fileName, 0 );
   bool   test2 = FileIsExist (fileName, FILE_COMMON );
   
   int file_handle= FileOpen (fileName, FILE_READ | FILE_TXT | FILE_ANSI ); 
   if (file_handle!= INVALID_HANDLE ) 
   { 
       PrintFormat ( "%s file is available for reading" ,filePath); 
       //PrintFormat("File path: %s\\Files\\",terminal_data_path);
       //--- read data from the file 
       while (! FileIsEnding (file_handle)) 
        { 
         //--- find out how many symbols are used for writing the time 
         str_size= FileReadInteger (file_handle, INT_VALUE ); 
         //--- read the string 
         str= FileReadString (file_handle,str_size); 
         
         array_size=:: ArraySize (m_file_symbols);
         :: ArrayResize (m_file_symbols,array_size+ 1 );
         m_file_symbols[array_size]=str;
         
         //--- print the string 
         PrintFormat (str); 
        } 
       //--- close the file 
       FileClose (file_handle); 
       PrintFormat ( "Data is read, %s file is closed" ,fileName); 
   }
   else
   {
       PrintFormat ( "Failed to open %s file, Error code = %d" ,fileName, GetLastError ()); 
   }
}

나는 많은 다른 매개변수와 filePaths를 시도했다

1 - 열 파일 경로를 사용하려고 시도했지만 아무 것도 작동하지 않습니다.

 int file_handle= FileOpen (fileName, FILE_READ | FILE_TXT | FILE_ANSI ); 

오류가 발생했습니다: 5002 e 5004

ERR_WRONG_FILENAME

5002

잘못된 파일 이름

ERR_CANNOT_OPEN_FILE

5004

파일 열기 오류

파일: