Ok, I had this working earlier and made some changes and now it is not working so it is driving me crazy.
I am trying to collect some data in a csv file every time my EA takes a trade so inside the same if statement the command to take the trade
At the beginning of the Start() I have:
int handle=FileOpen ("tradedatalog.csv", FILE_CSV|FILE_WRITE|FILE_READ, ';');
And in the if statement the order is taken in I have included:
FileSeek(handle, 0, SEEK_END);
FileWrite(handle, TimeCurrent()+ "," +Symbol()+ "," +Open+ "," +High+ "," +Low+ "," +Close);
The trades are taken but the file is no longer being written to.
Any help would be greatly appreciated.
Add code to check for errors - that should tell you what is happening.
For instance, see the error-handling code in the example given here:
1) Change your delimiter. Might not make a difference but using a semicolon is asking for trouble.
2) Make sure you're running MT as an administrator (Right click on the exe and "Run as..")
Thank you both for your help.
Changed the semicolon.
Added checking for errors, and found that by adding the File Open command with the rest allowed it to work right. have no clue why but was getting an error with the handle up top.
so just made it = the same thing down below and now works just fine. Thank you both for your help.