Here is the code the I am trying to write during Optimization.
file = FileOpen("testingFile.csv",FILE_WRITE|FILE_CSV|FILE_READ);
if(file == INVALID_HANDLE)
Print("File Not Opened: ", GetLastError());
Print("I am in OnTesterInit()");
Print("I am in OnTesterDEinit()");
Print("I am in OnTesterPass()");
Print("I am in OnTester()");
I am using MQL5. I could not see anything apart from the string header that I have written in the OnTesterInit(). Kindly, suggest me what mistake I am doing.
When you use OnTesterInit(), OnTesterDeinit(), and OnTesterPass():
OnTester() runs on a different thread. It doesn't have access to the file handle that these three will share.
What you can do to ensure OnTester() is firing: open a different file (using different file handle), write to it, and close from within OnTester() itself.
Thank you for your enlightening sir. Please can you guide me in writing the correct file writer during optimization. Inshort, I didn't understood the examples already available, hence, can you guide me with a small snippet of code which will help. I will be grateful.