MT4 Files Functions Replacement. - page 11

 

reg : installing files demo

i am unable to do installation i tried in metatreder demo account please can u guide me

 

Help with import function

I have an EA I have been working that calls on another EA for profit managing using the import function. The EA that is being imported is "managetpv34" which sets multiple take profits and it has been working great. The problem is once a trade is closed early and a new one re-opens for example a day later the "managetpv34" will look for the next take profit point wherever it left off with the first trade and not start over.

I have tried reseting the the take profit value to zero on the next trade but its not working, i'm missing something. Maybe there is a way to unload the "managetpv34" and reload it automatically when the next trade opens. Any tips would be greatly appreciated.

Files:
 

How to read text file

Hello,

This is great and easy to use.

I appreciate your nice tool.

Then I have one question.

gFileRead has 2 parameters, string and length, but I'd like to read a text file one line at a time.

Is it possible to read one line?

Thank you

Takuro

 

CSV file

I'm trying to make a csv file by gFileWrie.

bu don't know how to make an line end.

How do I make an line end by gFileWrite?

Thanks

 

Two functions are missing gFileCopy and gFileMove

gFileCopy and gFileMove are missing can you please help on this,

Thanks

codersguru:
sx ted,

I've updated the program. Now it includes these functions:

int gFileOpen(string file_name,int mode);

bool gFileWrite(int handle,string data);

bool gFileClose(int handle);

string gFileRead(int handle,int length=0);

void gFileSeek(int handle,int offset, int mode);

bool gFileDelete(string file_name);

int gFileSize(int handle);

int gFileTell(int handle);

bool gFileFlush(int handle);

bool gFileCopy(string source,string distance,bool IfExists);

bool gFileMove(string source,string distance);

I hope you enjoy it.
 

These files on MT5

Hi,

I think these files are great. nothing similar on the web. Very helpful.

My question is. How can we use these files on the new MT5? Do we need new files, new dll?

Thanks

 

Contiuous Appending to File During Backtest

I found this thread as I am trying to write information to a file while backtesting. I'm not completely sure how to set it up so that it opens the file, goes to the end of the file, adds information, and then closes it. I've tried multiple versions but haven't been able to get it to work (I'm sure it's probably something obvious). Does anyone know how make this happen? Any assistance would be much appreciated. Thanks.

 

Try it similar to this (you have to define the fileNameand messagethe rest will be done by this code) :

int handle = FileOpen(fileName, FILE_BIN|FILE_READ|FILE_WRITE);

if(handle > -1)

{

FileSeek(handle,0,SEEK_END);

FileWriteString(handle, message, StringLen(message));

FileClose(handle);

}

chemnteach:
I found this thread as I am trying to write information to a file while backtesting. I'm not completely sure how to set it up so that it opens the file, goes to the end of the file, adds information, and then closes it. I've tried multiple versions but haven't been able to get it to work (I'm sure it's probably something obvious). Does anyone know how make this happen? Any assistance would be much appreciated. Thanks.
 
mladen:
Try it similar to this (you have to define the fileNameand messagethe rest will be done by this code) :
int handle = FileOpen(fileName, FILE_BIN|FILE_READ|FILE_WRITE);

if(handle > -1)

{

FileSeek(handle,0,SEEK_END);

FileWriteString(handle, message, StringLen(message));

FileClose(handle);

}

Thank you for the input mladen. I was talking more from the perspective of the files + dll's that originated the thread. The problem with the "normal" MT4 functions is that they don't work when backtesting, which is where I would like to use them. I was trying to use the include file, etc. but can't get it to repeatedly append to the file, I only get one line. Any ideas?

 

...

Without knowing how does your code look like, the thing you are describing usually happens when onlyFILE_WRITEis used when the file is opened. Check that, and if it is true, use FILE_READ|FILE_WRITE when opening the file and use the code snippet applied to position to the end of file before writing a new line in it.

chemnteach:
Thank you for the input mladen. I was talking more from the perspective of the files + dll's that originated the thread. The problem with the "normal" MT4 functions is that they don't work when backtesting, which is where I would like to use them. I was trying to use the include file, etc. but can't get it to repeatedly append to the file, I only get one line. Any ideas?