Forex
Google

Go Back   Forex Trading > Downloads > Tools and utilities
Forex Forum Register FAQ Members List Calendar Search Today's Posts 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

Reply
 
LinkBack (4) Thread Tools Display Modes
  4 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 11-20-2005, 01:18 AM
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
Thumbs up MT4 Files Functions Replacement.

Hi folks,

A lot of people asked me and metaquotes forum about file handling functions.
I think MT4 have a lot of bugs in those functions.
1- They don't work in backtesting
2- They don't write outside "MetaTrader 4\experts\files" path.

Today I opened my Visual C++ and wrote a file handling dll for MT4, I hope you enjoy it, and its source code, and tell me your .

Setup:
1- Extract the "mtguru1.dll" to "MetaTrader 4\experts\libraries" path.
2- Extract "FilesDemo.mq4" to "MetaTrader 4\experts\indicators" path and compile it.
3- Extract "gFiles.mqh" to "MetaTrader 4\experts\include".
4- Load FilesDemo from your Indicators - don't forget to enbable "Allow DLL Import"
5- Enjoy.
Attached Files
File Type: zip mtguru1.zip (94.8 KB, 1033 views)
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by codersguru : 11-25-2005 at 01:26 PM. Reason: gFiles.mqh
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-21-2005, 12:22 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
Unhappy Feedback

Hi folks,

Any feedback please ?
__________________
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!
Reply With Quote
  #3 (permalink)  
Old 11-21-2005, 01:39 PM
fivewhy fivewhy is offline
Junior Member
 
Join Date: Oct 2005
Posts: 12
fivewhy is on a distinguished road
Well, I haven't tested it. But if it works..that is AWESOME!!
I checked out the demo .mq4 file, and it is so simple and elegant. Good work.

The only issue I have is what to do about new lines.
How do I use gFile to write a new line?

Last edited by fivewhy : 11-21-2005 at 01:58 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-21-2005, 02:09 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
Thumbs up Thank!

Quote:
Originally Posted by fivewhy
Well, I haven't tested it. But if it works..that is AWESOME!!
I checked out the demo .mq4 file, and it is so simple and elegant. Good work.

The only issue I have is what to do about new lines.
How do I use gFile to write a new line?
fivewhy,

Thank you very much for your comment.
I think the new line printing issue needs some work from me, Thanks for the notice.
__________________
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!
Reply With Quote
  #5 (permalink)  
Old 11-21-2005, 08:48 PM
Beluck's Avatar
Beluck Beluck is offline
Senior Member
 
Join Date: Oct 2005
Posts: 195
Beluck has much to be proud ofBeluck has much to be proud ofBeluck has much to be proud ofBeluck has much to be proud ofBeluck has much to be proud ofBeluck has much to be proud ofBeluck has much to be proud ofBeluck has much to be proud of
well done , but file functions (as well as many other) may be used directly from windows API dlls.

example of file copy function import:

#import "Kernel32.dll"
bool CopyFileA (string source_file, string destination_file, bool if_exist);

with DLLs you can do a lot of things, like SQL database access and so on.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-21-2005, 08:58 PM
fivewhy fivewhy is offline
Junior Member
 
Join Date: Oct 2005
Posts: 12
fivewhy is on a distinguished road
where can I find a list of all functions available in kernel32.dll (and other windows .dll's)?

Edit: Found it. See attched.
Attached Files
File Type: txt kernel32.txt (305.8 KB, 473 views)

Last edited by fivewhy : 11-21-2005 at 09:21 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-21-2005, 10:27 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
Question That's right, but?

Quote:
Originally Posted by Beluck
well done , but file functions (as well as many other) may be used directly from windows API dlls.

example of file copy function import:

#import "Kernel32.dll"
bool CopyFileA (string source_file, string destination_file, bool if_exist);

with DLLs you can do a lot of things, like SQL database access and so on.
Beluck,
That's right , but could you give me .mql demo shows me how to use the kernel32 functions CreateFile, OpenFile,WriteFile and ReadFile in MQL4

Code:
HANDLE CreateFile(
  LPCTSTR lpFileName,
  DWORD dwDesiredAccess,
  DWORD dwShareMode,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  DWORD dwCreationDisposition,
  DWORD dwFlagsAndAttributes,
  HANDLE hTemplateFile
);

HFILE OpenFile(
  LPCSTR lpFileName,
  LPOFSTRUCT lpReOpenBuff,
  UINT uStyle
);

BOOL WriteFile(
  HANDLE hFile,
  LPCVOID lpBuffer,
  DWORD nNumberOfBytesToWrite,
  LPDWORD lpNumberOfBytesWritten,
  LPOVERLAPPED lpOverlapped
);

BOOL ReadFile(
  HANDLE hFile,
  LPVOID lpBuffer,
  DWORD nNumberOfBytesToRead,
  LPDWORD lpNumberOfBytesRead,
  LPOVERLAPPED lpOverlapped
);
__________________
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!
Reply With Quote
  #8 (permalink)  
Old 11-25-2005, 10:21 AM
sx ted sx ted is offline
Junior Member
 
Join Date: Nov 2005
Posts: 5
sx ted is on a distinguished road
ted

alerts.mqh not part of mtguru1.zip, could not run FilesDemo? Thanking you in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 11-25-2005, 01:25 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
gFiles.mqh

Quote:
Originally Posted by sx ted
alerts.mqh not part of mtguru1.zip, could not run FilesDemo? Thanking you in advance.
sx ted,

I'm sorry, I meant "gFiles.mqh"

To run FilesDemo:

1- Extract the "mtguru1.dll" to "MetaTrader 4\experts\libraries" path.
2- Extract "FilesDemo.mq4" to "MetaTrader 4\experts\indicators" path and compile it.
3- Extract "gFiles.mqh" to "MetaTrader 4\experts\include".
4- Load FilesDemo from your Indicators - don't forget to enbable "Allow DLL Import"
__________________
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!
Reply With Quote
  #10 (permalink)  
Old 11-25-2005, 03:07 PM
sx ted sx ted is offline
Junior Member
 
Join Date: Nov 2005
Posts: 5
sx ted is on a distinguished road
ted

CodersGuru, thank u super, have u got equivalent of FileTell()
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/tools-utilities/386-mt4-files-functions-replacement.html
Posted By For Type Date
File functions - Part 1 This thread Refback 03-05-2008 01:29 PM
MT4编程学习教程! - MT4系统交易 - 外汇牛人邦 飞狐免费外汇行情接收!飞狐外汇接口! - Powered by Discuz! This thread Refback 01-11-2008 05:45 PM
Mql - Metatrader Development Course This thread Refback 07-19-2007 02:50 AM
File functions - Part 1 | www.metatrader.info This thread Refback 06-21-2007 06:21 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
File Functions intelligent_14 Questions 6 07-11-2006 08:37 PM
Unusual Functions intelligent_14 Questions 3 06-23-2006 11:20 PM
Appendix 2 - Trading functions codersguru Lessons 8 12-26-2005 01:46 PM
Lesson 7 - Functions codersguru Lessons 2 11-02-2005 03:32 PM


All times are GMT. The time now is 07:30 AM.