You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm experimenting with using File-Data as Variables. In other-words, I'm playing around with codes which have no Global_Scope nor Global_Variable_Set Variables defined. Yet can have as many Pseudo Global_Scope_Variables which could recover themselves like a Global_Variable_Set. I just started this project yesterday. Another reason for doing this is to get more familiar with Files, especially Binary-Files. The obvious trade-off here is Speed vs Resources [Memory].
The Speed will make a difference within the Strategy-Tester [this I already know] because it's slow-enough as-is. However, the question I'm trying to answer is "If this'll make a noticeable difference for a Live running Expert". My gut tells me the file-speed is good enough but there's only one way to find out.
The point is that if a file is closed as soon as it is no longer needed to be open it has less risk of being open at the time of a crash . . . . if I am working with 5 files and keep them open then they are open all the time while the EA runs, any crash during that long time period will result in 5 files being left open.
What happen if MT4 crash during its read/write operation, File Close does not help either :).
Don't worry about that, when MT4 crash or terminate (like ubzen did) the handle is gone, file is no longer in use.
See MSDN CreateFile which can be used for creating and opening a file, this will return unique identifier which we called : File Handle. Another way to open a file is using OpenFile function which also return File Handle.
MSDN for File Handles,
"When a file is opened by a process using the CreateFile function, a file handle is associated with it until either the process terminates or the handle is closed using the CloseHandle function. The file handle is used to identify the file in many function calls."
If MT4 crashes, sure the file is closed. But any buffered output will not be written and has been lost.
What happens if the EA thread crashes (e.g. divide by zero) What happens then?
"When a file is opened by a process using the CreateFile function, a file handle is associated with it until either the process terminates or the handle is closed using the CloseHandle function. The file handle is used to identify the file in many function calls."
If MT4 crashes, sure the file is closed. But any buffered output will not be written and has been lost.
What happens if the EA thread crashes (e.g. divide by zero) What happens then?
If MT4 crashes, sure the file is closed. But any buffered output will not be written and has been lost.
What happens if the EA thread crashes (e.g. divide by zero) What happens then?
... or CI or Script :
If MT4 associate file handle with an mql programs, then the handle is gone. If MT does not associate file handle with an mql programs, then we will have error too many opened files, sooner or later. In Win API its : System Error Code (0 -499) .
I said if, coz I don't know for sure :)