Forex
Google

Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum FAQ Members List Calendar Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

 
 
LinkBack Thread Tools
 
Old 11-10-2006, 03:03 PM
owkenobi's Avatar
owkenobi owkenobi is offline
Junior Member
 
Join Date: Nov 2006
Posts: 2
owkenobi is on a distinguished road
Question MQL4 FileOpen function

Hi guys,
I need to add data to an existing file, a cvs file.

On MQL4 reference I found that "If there is a need to add data to an
existing file, it must be opened using combination of FILE_READ |
FILE_WRITE." but does not work.

Every time I launch Metatrader the file reset to zero-length.

Anyone has properly did it?

Thank you in advance,
Obi Wan.
__________________
Remember, the F(X)orce will be with you, always.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-10-2006, 03:43 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Wink AppendToFile

Quote:
Originally Posted by owkenobi
Hi guys,
I need to add data to an existing file, a cvs file.

On MQL4 reference I found that "If there is a need to add data to an
existing file, it must be opened using combination of FILE_READ |
FILE_WRITE." but does not work.

Every time I launch Metatrader the file reset to zero-length.

Anyone has properly did it?

Thank you in advance,
Obi Wan.
Please try this script code!
I think you missed FileFlush or you didn't use FileSeek to go to the end of the file!
Attached Files
File Type: mq4 AppendToFile.mq4 (905 Bytes, 71 views)
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-10-2006, 04:17 PM
owkenobi's Avatar
owkenobi owkenobi is offline
Junior Member
 
Join Date: Nov 2006
Posts: 2
owkenobi is on a distinguished road
Quote:
I think you missed FileFlush or you didn't use FileSeek to go to the end of the file!
Yes, I missed FileSeek!

Now it works!

Thank you codersguru.
Obi Wan.

handle=FileOpen(gs_fname, FILE_CSV|FILE_READ, ';');
if (handle<1)
{
FileClose(handle);
handle=FileOpen(gs_fname, FILE_CSV|FILE_READ|FILE_WRITE, ';');
if (handle>0)
{
FileWrite(handle, gs_fname);
FileFlush(handle);
}
}
else
{
FileClose(handle);
handle=FileOpen(gs_fname, FILE_CSV|FILE_READ|FILE_WRITE, ';');
if (handle>0)
{
FileSeek(handle,0,SEEK_END);
}
}
__________________
Remember, the F(X)orce will be with you, always.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-10-2006, 05:07 PM
DudeWorks's Avatar
DudeWorks DudeWorks is offline
Member
 
Join Date: Nov 2005
Posts: 55
DudeWorks is on a distinguished road
Heres the tick logger code, it works great , however I've been trying to integrate into Cybertrader to log stats and orders and I've got it all worked out except I'm getting the error that too many files are open when in fact it only opens it once.... but Im getting close to solving... I'm working on this right now.. but maybe someone will beat me to the punch
Attached Files
File Type: mq4 TickLogger-v0[1].15.mq4 (1.5 KB, 47 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-10-2006, 09:47 PM
Nicholishen's Avatar
Nicholishen Nicholishen is offline
Senior Member
 
Join Date: Dec 2005
Posts: 531
Nicholishen is on a distinguished road
Quote:
Originally Posted by codersguru
Please try this script code!
I think you missed FileFlush or you didn't use FileSeek to go to the end of the file!
Hi guru,

I know you work a lot with file handling. How can I get two experts from two brokers to write to the same file?
__________________
"Anyone who has never made a mistake has never tried anything new." -Albert Einstein
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-14-2006, 01:39 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Exclamation C++ Task!

Quote:
Originally Posted by Nicholishen
Hi guru,

I know you work a lot with file handling. How can I get two experts from two brokers to write to the same file?
This task have to be C++ task! I'll inform you when I update the File Handling DLL!
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-17-2008, 09:28 PM
ingvar_e ingvar_e is offline
Junior Member
 
Join Date: Dec 2007
Location: Outside Stockholm
Posts: 19
ingvar_e is on a distinguished road
External file handler

Somewhere in the tons of documentation I have read on MetaTrader I saw an external file write routine that could be downloaded. I get odd results sometimes when using the internal file handling so I would like to try this one. Now I cant find it. Anyone knows?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-18-2008, 07:52 AM
newdigital newdigital is offline
Administrator
 
Join Date: Sep 2005
Posts: 15,413
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
I moved your post to this thread.
Also you can look at this thread dose it posible to creat any function of "mql code" posting in this forum? where I am collecting all the links which can help coders.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-18-2008, 07:53 AM
newdigital newdigital is offline
Administrator
 
Join Date: Sep 2005
Posts: 15,413
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
This thread #import and this one can be related to your question Execute SQL from Metatrader
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-18-2008, 02:17 PM
ingvar_e ingvar_e is offline
Junior Member
 
Join Date: Dec 2007
Location: Outside Stockholm
Posts: 19
ingvar_e is on a distinguished road
This was what I was looking for

MT4 Files Functions Replacement.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Welcome to the MQL4 course codersguru Metatrader 4 mql 4 - Development course 84 05-18-2008 05:59 PM
www.mql4.com DeSt Metatrader 4 18 02-01-2006 11:59 PM
FileOpen problem... twinsen Questions 6 11-20-2005 11:53 PM


All times are GMT. The time now is 08:41 PM.