Questions from a "dummy" - page 108

 

My Expert Advisor takes pattern values from a csv file. when trading, everything works but not in the tester. where should i put the csv file and what folder should i create?

I did it this way

The file is opened in the subfolder MQL5\files of the client terminal (or in case of testing, in the folder_Testing_agent\MQL5\files).

But it doesn't work and where is the testing agent directory located?

 
openlive:
My Expert Advisor takes pattern values from a csv file. when trading, everything works, but not in the tester. where should i put the csv file and which folder should i create?
Look in the Reference Manual for the description of the tester_file constant
 
Yedelkin:
Look in the Reference Manual for the description of the tester_file constant

Looked at it, put the file in Mql5\Tester\Files

but the tester just stands still.

Here's the tester file itself.

Files:
 
openlive:

looked at it, put the file in Mql5\Tester\Files

The description of the FileOpen() function says: "The file opens in the client terminal folder in subfolder MQL5\files (or the_agent_tester\MQL5\files directory in case of testing)". Try:

a) specify a full path to the file like

string filename=TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL5\\Tester\\Files\\"+"file.csv";

b)put the file in the directory of the agent .

I haven't encountered this myself. From the description of other functions of working with files, it follows that in the case of testing, the file must be sought in Mql5\Tester\Files.

An addition. Yes, you have opened several files there. And in tester_file you have only one.

 
Yedelkin:

The description of FileOpen() function says: "File opens in the folder of the client terminal in subfolder MQL5\files (or catalog_agent_testing\MQL5\files in case of testing)". Try:

a) specify the full path to the file like

b)put the file in the directory of the agent .

I haven't encountered this myself. I haven't found any direct instruction in the Handbook, where the file for testing should be placed.

Addendum. Yes, you have several files open there. And in the tester_file is specified only one.

a) did it - did not help.

b) I don't understand how to do it. I have only MQL5\Tester\Files folder and I cannot figure out which folder is meant undertesting_agent_folder\MQL5\files.

 

Here's more: https://www.mql5.com/ru/forum/1111/page182#comment_31599 See two posts. It kinda worked if file was in \MQL5\Files.

Well, you can try to move it to shared folder at TerminalInfoString(TERMINAL_COMMONDATA_PATH). And when opening the file itself, set flag FILE_COMMON.

 

Yedelkin:

Here's more: https://www.mql5.com/ru/forum/1111/page182#comment_31599 See two posts. It kinda worked if file was in \MQL5\Files.

Well, you can try to move it to shared folder at TerminalInfoString(TERMINAL_COMMONDATA_PATH). And set the FILE_COMMON flag when opening the file itself.

put the file in C:\ProgramData\MetaQuotes\Terminal\Common\Files, put theFILE_COMMON flag

tester doesn't say anything anyway.

Don't know what else to do

 

In other words, finding the file neither in Mql5\Tester\Files, nor in Mql5\Files, nor in the shared folder of client terminals helps?

Put FileIsExist() check with output.

Did you write the other files used by the program using tester_file?

A remark unrelated to the main question. Do you have

int handle16=FileOpen("signal10000.csv",FILE_WRITE|FILE_CSV,";");
int handle17=FileOpen("signal10000.dat",FILE_WRITE|FILE_BIN,";"); 
int handle=FileOpen(filename,FILE_READ|FILE_CSV,";");

etc.

Are called on every tick. This is very cumbersome. Unless there is a special reason, the file handle should be obtained in the OnInit() function, checked for disability, and then work with the open file handle instead of theFileOpen() function.

Документация по MQL5: Файловые операции / FileOpen
Документация по MQL5: Файловые операции / FileOpen
  • www.mql5.com
Файловые операции / FileOpen - Документация по MQL5
 
Yedelkin:

In other words, finding the file neither in Mql5\Tester\Files, nor in Mql5\Files, nor in the shared folder of client terminals helps?

Put FileIsExist() check with output.

Did you write the other files used by the program using tester_file?

A remark unrelated to the main question. Do you have

etc.

Are called on every tick. This is very cumbersome. Unless there is a special reason, the file handle should be obtained in the OnInit() function, checked for disability, and then work with the open file handle, not theFileOpen() function.

The files aren't actually called every tick... there is a check for a new bar. but thanks anyway, i'll fix it

I will try FileIsExist()

 
openlive:

The files aren't actually called every tick... There's a check for a new bar. but thanks anyway, I'll fix it

Yeah, didn't look at it thoroughly. But you got the gist right :)
Reason: