There are errors in your code.
Here's my code that adds to a file on every tick:
// Function WriteToFile ***********************
void WriteToFile(double val1, string str2)
{
int handle;
handle=FileOpen("Log.csv", FILE_CSV|FILE_WRITE|FILE_READ, '\t');
FileSeek(handle, 0, SEEK_END);
FileWrite(handle, TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS), DoubleToStr(val1, 4), str2);
FileClose(handle);
return(0);
}
//*********************************************
The file is saved to 'experts/files' folder
sg1
Trying to export tickdata during trades ONLY, for further analysis in excel:
I have written an ea, so when an position is taken, i want every tick or 1 minutebar-low to be exported inte an document.
I have never used the file-commands before, but I gave it a try:
{
int handle=FileOpen("Breakout-export.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle>0){
// write header
FileWrite(handle,OrderSymbol(),OrderTicket(),Bid);
FileClose(handle);
}}The problem is that with this i don't get a file at all. I shuold be placed in the experts-folder, right?
Am I on the right track, or is my code really fucked up?
Thanks in advance,
Johan