Download MetaTrader 5

Error 5004

To add comments, please log in or register
Write your articles using our editor. It is convenient!
coder_xx
13
coder_xx 2014.01.22 17:05 

I am getting this error despite declaring the tester_file in my EAs header and the file queried is physically present in the MQL5\Files directory. I am launcing MT5 with the /portable suffix in the shortcut. Here is my code.

 

//+------------------------------------------------------------------+
//|                                                           EA.mq5 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property version   "1.00"
#property tester_file   "_DATA.bin";

  
struct _STRUCT_P_4
  {
      double p_1_mn1;
  };
  
_STRUCT_P_4  _read[1],_write[];
  
input bool           _tester_read   =  false;
input bool           _tester_write  =  false;


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+

int OnInit()
  {

   //--- create timer
  
    EventSetTimer(60);
   
   if(_tester_write){    
      int _write_handle=FileOpen("_DATA.bin",FILE_READ|FILE_BIN);
      if(_write_handle!=INVALID_HANDLE){
         FileReadArray(_write_handle,_write,0,WHOLE_ARRAY);
         FileClose(_write_handle);
         for(int i=0; i<ArraySize(_write); i++){
            Print("... ");}}
      else if(_write_handle==INVALID_HANDLE){ Print(" invalid handle... ",GetLastError()); }}
   
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
coder_xx
13
coder_xx 2014.01.22 18:16  
coder_xx:

I am getting this error despite declaring the tester_file in my EAs header and the file queried is physically present in the MQL5\Files directory. I am launcing MT5 with the /portable suffix in the shortcut. Here is my code.

 

The binary file is 27mb. Is there a size limit for this to work? Smaller files of about 4mb are being accessed ok.
Alain Verleyen
Moderator
30739
Alain Verleyen 2014.01.22 19:30  
coder_xx:
The binary file is 27mb. Is there a size limit for this to work? Smaller files of about 4mb are being accessed ok.
You have this error when running your code with Strategy Tester or on a live chart or both ?
coder_xx
13
coder_xx 2014.01.22 22:20  
angevoyageur:
You have this error when running your code with Strategy Tester or on a live chart or both ?
When running strategy tester. I only use it with strategy tester.
Alain Verleyen
Moderator
30739
Alain Verleyen 2014.01.23 00:56  
coder_xx:
When running strategy tester. I only use it with strategy tester.

I am not aware of a file size limit. Maybe the file isn't copied to testing environment.

If you can send the date file I can check it, otherwise I don't see how to help you.

Rogerio Figurelli
Moderator
39651
Rogerio Figurelli 2014.01.23 05:35  
Coder_xx, sorry if this a basic question, but are you sure your file is at your MT5 data folder and not at your MT5 installation one?
To add comments, please log in or register