Thank you, the code works fine, it creates the file when the EA is loaded, then on every tick I open the file, put tons of information in the file and then close it. But as soon as it opens an order it doesn't work anymore.
I searched this everywhere and I can't find any info on the error, I can't find anyone that's had the same problem, I can't find anyone with the same error, some people have had:
"invalid integer number as parameter 1 for TimeToNumber function"
But I can't find anything on:
"invalid integer number as parameter 1 for FileWritefunction"
Thank you, the code works fine, it creates the file when the EA is loaded, then on every tick I open the file, put tons of information in the file and then close it. But as soon as it opens an order it doesn't work anymore.
I searched this everywhere and I can't find any info on the error, I can't find anyone that's had the same problem, I can't find anyone with the same error, some people have had:
"invalid integer number as parameter 1 for TimeToNumber function"
But I can't find anything on:
"invalid integer number as parameter 1 for FileWritefunction"
SUre, this is the code for the init function:
int init() { //---- File_Name = StringConcatenate(Name_of_file, " - ", Symbol(), " - ", TimeToStr(TimeLocal(),TIME_DATE), " - ", TimeHour(TimeLocal()), ".", TimeMinute(TimeLocal()), ".", TimeSeconds(TimeLocal()), ".txt"); Handle=FileOpen(File_Name,FILE_CSV|FILE_WRITE,";");//File opening if(Handle==-1) // File opening fails { Alert("An error while opening the file. ",// Error message "May be the file is busy by the other applictiom"); PlaySound("Bzrrr.wav"); // Sound accompaniment return; // Exir start() } FileClose( Handle ); //---- return(0); }
So that just creates the file.
Then in the start function I open the file with:
Handle=FileOpen(File_Name,FILE_CSV|FILE_READ|FILE_WRITE,";");//File opening //Handle = 1; Print("Handle: ", Handle); if(Handle==-1) // File opening fails { Alert("An error while opening the file. ",// Error message "May be the file is busy by the other applictiom"); PlaySound("Bzrrr.wav"); // Sound accompaniment return; // Exir start() } FileSeek(Handle, 0, SEEK_END);
And then I write stuff in the file like:
Qnt_Symb=FileWrite(Handle,"**** STARTING TICK ", Symbol(), ": ", TimeToStr(TimeLocal(),TIME_DATE|TIME_SECONDS), " ****"); Qnt_Symb=FileWrite(Handle,"************************************************************");
And then I close the file at the end
Qnt_Symb=FileWrite(Handle,"***************************"); Qnt_Symb=FileWrite(Handle,"**** END TICK ", Symbol(), " ****"); FileClose( Handle ); //---- return(0);
And that's it.
Thanks for your help!
SUre, this is the code for the init function:
So that just creates the file.
Then in the start function I open the file with:
And then I write stuff in the file like:
And then I close the file at the end
And that's it.
Thanks for your help!
Handle=FileOpen(File_Name,FILE_CSV|FILE_WRITE,";");//File opening Handle=FileOpen(File_Name,FILE_CSV|FILE_READ|FILE_WRITE,";");//File openingInvalid last argument - not an int
Have you searched for ( Ctrl + F ) Handle in your code to find other declarations ? do you have any returns in start() other than at the end ? have you looked at the CSV file to see if it is complete ? if arts are missing it might give you some idea of what is or isn't being executed.
Hello Raptor UK,
There are no other Handle decalrations
The only other return is the one you see there when opening the file if Handle is -1
Not sure what you men if the file is complete. When the order opens the whole start function is processed and I know because the file has the last lines, the ** END TICKET ** lines so I know it got to the end and it closed the File.
What do you mean arts are missing? Sorry I don't know what arts are?
Hi WHRoeder,
What do you mean? The last argument of FileOpen is
delimiter | - | Delimiter character for csv files. By default, the ';' symbol applies. |
Cheers
Hello Raptor UK,
There are no other Handle decalrations
The only other return is the one you see there when opening the file if Handle is -1
Not sure what you men if the file is complete. When the order opens the whole start function is processed and I know because the file has the last lines, the ** END TICKET ** lines so I know it got to the end and it closed the File.
What do you mean arts are missing? Sorry I don't know what arts are?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have an EA that writes to a log file some info, at some points it decides to open an order and when this happens the EA doesn't write to the file anymore, I just get:
invalid integer number as parameter 1 for 'FileWrite' function
I'm attaching an screen shot: fo how when it opens the order the file handle doesn't change but for some reason it can't open the file any more. HELP!!