I want to test an EA that makes use of external signals in the Strategy Tester and the thread states that the native filehandling does not work in the strategy tester. So I have tried to use the dll supplied in this thread. The input I want to process is in a file looking like this:
I do create the file myself so I can use other types of delimiters.
How do I use the dll to get one "record" at the time? I can do the parsing for the individual fields.
How do I know when I have reached EOF?
I have tried a few variations but I get inconsistent results and sometimes garbage. Writing data as in the example works fine but I want to read data.
Well, perserverance rules!
After several hours I found out this:
The file handler refuses to open a file I have created with another program. Open returns -1. If I use the file that was created by the demo (mt4.log) and copies my content into it open works. Cant figure out why. Strange
I made my "records" fixed length and read the length of the "record" plus 2 to accomodate for "CRLF" at the end of each record. I got the length of the file, divided by the record length and looped to get all my records into an array:
Here is the code:
file = gFileOpen("c:\mt4.log",READ);
filesize = gFileSize(file);
records = filesize/25;
inArr = gFileRead(file,25);
Print(inArr[filesize-1]); //Check the last one
indicator with fileoutput
hello traders and programmers.
i need help with a codesegemnt for a new indicator.
the indicator should be able to write a file with relevant information, but it should only write after open a new candle. not every tick.
how could this be done? what i try to do is, on every new candle write OHCL of the last 1000 bars to train a PNN. this should be done outside with RAPID-I.
and with some other informations to learn what the probability the close of a candle could be.
please help. would be a great project, but so simple things i'm to stupid (or lazy) to do :-)
datetime timeprev=0; before init()
timeprev=Time; right underneath start()
and thats it.
nice this was very fast reply.
thank you elitecamper
Why was the move function removed from the library
I can not tell you how valuable you are to me, You deserve much of the praise I receive from my clients, since without you I would not be able to do my job in support of them.
Is there a reason that the Move function was not implemented as is referenced in your tutorial.
Thanks Very Much Again four your service
Looking the source code of mtguru1.dll I'have found that gFileRead() function should not work. Am I Wrong ?
gFileRead() uses a local variable to store the string read from the file. When the function returns, it returns a pointer to that variable, but this pointer can be a valid one because the local variable pbuffer goes out of scope.
So, from a MQL4 EA, an instruction like this should crash :
string buffer = gFileRead( handle, 50 );
and if it works it's strange ...
P.S.: I've posted this in the wrong thread, before. https://www.mql5.com/en/forum/172885.
.... but this pointer can be a valid one ....
but this pointer CANNOT be a valid one
Execute an exe file
I want to do a simple thing (so I thought). I want to simply open (launch) an external program from an EA. (not in the EA)
So just for exampe purposes. Let us say I wanted to open Microsoft word when a certain thing happens in the EA.
I have doen this before but I cannot find the script, I have spent 2 hours searching the web. Next time I will save the code somewhere safe!
I got this error "2008.10.21 01:54:34 Fundamental Trader DailyFX_MQL4 v0.02: handle 2 does not exist in FileClose"
How can I do ?