Writing to a file with mql4

 
Good evening to all, I'm new on the forum and I have a small question: how to write in a txt file with mql4, I found topics in this forum that led me to try things but without success ... 

Thank you in advance for your answers
 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
 
Ok thanks, I didn't know 
 
Do you have any ideas?
 

Look in the documentation.

FileWrite and FileWriteString.

 

Thank you for your answer, here's what I tried to do but it doesn't work... when I compile there is no error but when I launch my strategy tester I don't see a file created with gain written in it 

string gain = "GAIN";

void on start ()

{

int filehandle = FileOpen("fichier.txt", FILE_READ|FILE_WRITE|FILE_TXT|FILE_ANSI);

FileWriteString(filehandle,gain);

}

 
Hugo Tram:

Thank you for your answer, here's what I tried to do but it doesn't work... when I compile there is no error but when I launch my strategy tester I don't see a file created with gain written in it 

string gain = "GAIN";

void on start ()

{

int filehandle = FileOpen("fichier.txt", FILE_READ|FILE_WRITE|FILE_TXT|FILE_ANSI);

FileWriteString(filehandle,gain);

}

Are you looking in the correct place?

Look in the Tester folder.

 
all right thank you, where can I find the Tester folder please ?
 
Hugo Tram:
all right thank you, where can I find the Tester folder please ?

File - Open Data Folder - Tester - Files.

 
in my browser I do have the folder files but there is only one file called:"trading.db"
 
Hugo Tram:

Thank you for your answer, here's what I tried to do but it doesn't work... when I compile there is no error but when I launch my strategy tester I don't see a file created with gain written in it 

string gain = "GAIN";

void on start ()

{

int filehandle = FileOpen("fichier.txt", FILE_READ|FILE_WRITE|FILE_TXT|FILE_ANSI);

FileWriteString(filehandle,gain);

}

I just realised that your code is a script.

How did you manage to open a script with the strategy tester?

You should also close the file after you have finished with it.

Reason: