Cannot read data file on VPS

 

Below is my code, very small


///////////////////////////////////

#property copyright "Copyright 2020, Kla"

#property link      "https://www.mql5.com"

#property version   "1.0"

#property tester_file "data.txt"


int OnInit()

{

   int h=FileOpen("data.txt",FILE_READ|FILE_TXT, '\t', CP_UTF8);

   if(h==INVALID_HANDLE)

   {

      Print("Cannot open data file. Error: ", GetLastError());

      return (INIT_PARAMETERS_INCORRECT);

   }

   string s = FileReadString(h);  

   FileClose(h); 

   Print("OK");

   return(INIT_SUCCEEDED);

}

//////////////////////////////////////////


My file data.txt is in <Data Folder>\MQL5\Files. Created with notepad on windows, saved in UTF-8 encoding.

I use Metatrader 5 for Windows, build 2730 (dec 2020).


The expert executes fine locally, but when I migrate on VPS, I always receive 5004 error.


Please help.

 

Forum on trading, automated trading systems and testing trading strategies

When you post code please use the CODE button (Alt-S)!

Use the CODE button


 

If it is related to MQL5 VPS so use the following:

---------------

How to transfer the files (for example, txt file) to VPS

Forum on trading, automated trading systems and testing trading strategies

VPS and txt

Rashid Umarov , 2019.02.13 15:52

First, read the online VPS help , there is also a video.

To transfer your own files to MetaTrader VPS, you need to specify the propert compiler in the code. It requires a certain level of ownership of the subject. 

Forum on trading, automated trading systems and testing trading strategies

VPS and txt

Slava , 2019.02.13 15:52

To transfer a file to a hosting server (as well as a tester agent), you need to use the directive

#property tester_file "<file_name>"

Virtual hosting for MetaTrader 5
Virtual hosting for MetaTrader 5
  • www.mql5.com
The fastest VPS server for forex trading from the MetaTrader 4/5 terminal developers
 
I have no problem for migration on VPS. I have done it multiple times in previous EA. It is my first time with such a problem. In the log, I read that 2 files was sent to the VPS server, but I am not sure the data file was received.
 
sylvanuskla:
I have no problem for migration on VPS. I have done it multiple times in previous EA. It is my first time with such a problem. In the log, I read that 2 files was sent to the VPS server, but I am not sure the data file was received.
What do the logs say when your EA tries to read the files?
 

Below the log from the PS tab. I don't see anything.  The incorrect parameters line come from my own code.


2020.12.24 11:13:13.820 Virtual Hosting close command received

2020.12.24 11:13:13.831 Terminal exit with code 0

2020.12.24 11:13:13.831 Network '30510189': disconnected from MetaQuotes-Demo

2020.12.24 11:13:13.853 Terminal stopped with 0

2020.12.24 11:13:13.856 Terminal shutdown with 0

2020.12.24 11:13:14.342 Terminal MetaTrader 5 x64 build 2724 started for MetaQuotes Software Corp.

2020.12.24 11:13:14.344 Terminal Windows Server 2016 build 14393 on Hyper-V, Intel Xeon  E5-2670 v2 @ 2.50GHz, 38   63 Gb memory, 34   95 Gb disk, IE 11, RDP, Admin, GMT+1

2020.12.24 11:13:14.344 Terminal C:\hosting\instances\26B4916D1A3E493FCE66E1D38DCD7344

2020.12.24 11:13:14.344 Terminal launched with C:\Hosting\instances\26B4916D1A3E493FCE66E1D38DCD7344\start.ini

2020.12.24 11:13:14.404 Experts expert TestExpert (EURUSD,H1) loaded successfully

2020.12.24 11:13:14.925 Network '30510189': authorized on MetaQuotes-Demo through Access Point 6

2020.12.24 11:13:14.955 Network '30510189': terminal synchronized with MetaQuotes Software Corp.: 3 positions, 3 orders, 131 symbols, 0 spreads

2020.12.24 11:13:14.955 Network '30510189': trading has been enabled - hedging mode

2020.12.24 11:13:14.957 Terminal '30510189': 1 chart, 1 EA, 0 custom indicators, signal disabled

2020.12.24 11:13:15.134 Experts initializing of TestExpert (EURUSD,H1) failed with code 32767 (incorrect parameters)

2020.12.24 11:13:15.149 Experts expert TestExpert (EURUSD,H1) removed

2020.12.24 11:13:16.351 Network '30510189': scanning network for access points

2020.12.24 11:13:16.367 Terminal '30510189': 1 chart, 0 EAs, 0 custom indicators, signal disabled

2020.12.24 11:13:16.377 Terminal RAM: 102 Mb reserved, 162 Mb committed

2020.12.24 11:13:17.505 Network '30510189': ping to current access point Access Point EU 3 is 24.10 ms [next point Access Point EU 1 is 0.21 ms]

2020.12.24 11:13:17.508 Network '30510189': scanning network finished

2020.12.24 11:13:17.508 Network '30510189': auto connecting to a better access point with 100 % quality (previous: 97 %)

2020.12.24 11:13:17.508 Network '30510189': connection to MetaQuotes-Demo lost

2020.12.24 11:13:19.684 Network '30510189': authorized on MetaQuotes-Demo through Access Point EU 1 (ping: 0.21 ms, build 2730)

2020.12.24 11:13:20.050 Network '30510189': terminal synchronized with MetaQuotes Software Corp.: 3 positions, 3 orders, 131 symbols, 0 spreads

2020.12.24 11:13:20.050 Network '30510189': trading has been enabled - hedging mode

2020.12.24 11:13:20.051 Terminal '30510189': 1 chart, 0 EAs, 0 custom indicators, signal disabled

2020.12.24 11:13:22.430 Terminal '30510189': 1 chart, 0 EAs, 0 custom indicators, signal disabled, last known ping to Access Point EU 1 is 0.21 ms

2020.12.24 11:13:22.441 Terminal RAM: 101 Mb reserved, 164 Mb committed

2020.12.24 11:13:23.572 Network '30510189': ping to current access point Access Point EU 1 is 0.21 ms

Reason: