Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 09-27-2008, 09:11 PM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Multiple mt4 broker communication?

Hello everyone,

I have scoured the internet trying to figure out how to make multiple (separate broker) mt4 platforms read and write to a universal shared file. This shared file would not reside within the mt4 platform framework, but be an external application. I would like this file to receive real time data, from multiple broker terminals, as well as have the ability to be read from multiple terminals.

I've looked into dlls, which I assume must be used. Is anyone willing to provide input, or work on such a project?

I would love some serious response.

Thank You,

-wolfe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 09-27-2008, 10:03 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,218
matrixebiz is on a distinguished road
Oh my god, I was just about to post a question regarding the exact same thing

I thought I read somewhere about MT4 EA's being able to read/write history logs or whatever, to/from TXT files.

What I'm looking for is to have ONE platform write to a TXT file when it's time to place a trade for example, while the SECOND platform is reading that TXT file and when it sees that the signal from the ONE platform has written to that TXT file then the SECOND platform makes the trade.

Hope to get an answer soon.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 09-27-2008, 10:09 PM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Quote:
Originally Posted by matrixebiz View Post
Oh my god, I was just about to post a question regarding the exact same thing

I thought I read somewhere about MT4 EA's being able to read/write history logs or whatever, to/from TXT files.

What I'm looking for is to have ONE platform write to a TXT file when it's time to place a trade for example, while the SECOND platform is reading that TXT file and when it sees that the signal from the ONE platform has written to that TXT file then the SECOND platform makes the trade.

Hope to get an answer soon.
This is basically what I would like to do. Have multiple EA's on seperate brokers, reading from, and writing to a universal text file. I'm sure it can be done, I'm just not quite sure how to go about it. The problem is, the text file can't be in the mt4 directory, because we are using more than one broker platform to "communicate" with a "shared" file.

Thanks for the interest matrixebiz!

Last edited by wolfe; 09-27-2008 at 10:11 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 09-27-2008, 11:14 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,218
matrixebiz is on a distinguished road
I posted in a thread here;
http://www.forexfactory.com/showthread.php?t=103881
to see if it is possible now for the newer versions of MT4 to write/read to txt files outside it's own directory which wasn't possible before.

Last edited by matrixebiz; 09-27-2008 at 11:23 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 09-27-2008, 11:34 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,218
matrixebiz is on a distinguished road
There are commands like FILE_WRITE but not sure if you can change the name of the file to a directory +filename.

int FileWrite( int handle, ...)
The function is intended for writing of data into a CSV file, delimiter being inserted automatically. After writing into the file, the line end character "\r\n" will be added. Numbers will be converted into a text at output (see the Print() function).
Returns the count of written characters or a negative number if an error occurs.
To get the detailed error information, one has to call the GetLastError() function.
Parameters:
handle - File handle returned by the FileOpen() function.
... - User data to write, separated by commas. It can be up to 63 parameters.
Data of int and double types are automatically converted into a string, but those of color, datetime and bool typesare not automatically converted and will be written to file as they are (as integers).
Arrays cannot be passed as a parameter, they can be output elementwise.

Sample:
int handle;
datetime orderOpen=OrderOpenTime();
handle=FileOpen("filename", FILE_CSV|FILE_WRITE, ';');
if(handle>0)
{
FileWrite(handle, Close[0], Open[0], High[0], Low[0], TimeToStr(orderOpen));
FileClose(handle);
}

Change "filename" to "C:\Temp\filename" ??

Then you can do a FileReadString;
string FileReadString( int handle, int length=0)
The function reads the string from the current file position. Applies to both CSV and binary files. For text files, the string will be read before the delimiter. For binary file, the given count of characters will be read to the string. To get the detailed error information, one has to call the GetLastError() function.
Parameters:
handle - File handle returned by the FileOpen() function.
length - Amount of characters for reading.

Sample:
int handle;
string str;
handle=FileOpen("filename.csv", FILE_CSV|FILE_READ);
if(handle>0)
{
str=FileReadString(handle);
FileClose(handle);
}


Maybe we'll get an answer soon

Last edited by matrixebiz; 09-27-2008 at 11:38 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 09-28-2008, 12:16 AM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,218
matrixebiz is on a distinguished road
if you already know how to actually get an EA to write a file in MT4 then you can create a simple looping DOS batch file to copy the file from one location to another. If that helps.

:loop
xcopy c:\temp\test.csv c:\temp2
del c:\temp\test.csv
goto:loop

so the batch file will just keep checking the folder and once the file is created it will copy it from the temp directory to the temp2 directory or whatever.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 09-28-2008, 01:58 AM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,218
matrixebiz is on a distinguished road
Ah, Ha, got this from another user post;



"I finally worked out how to read a file from another folder in mq4 took me ages
you have to enable dlls in the ea ( not sript) and do it this


string buffer=ReadFile("C:\\Program Files\\MetaTrader - North Finance\\experts\\files\\Signal.txt ");
siggy=StringSubstr(buffer,0,1);
if (siggy=="1") siggy="BUY";
if (siggy=="2") siggy="STRONG BUY";
if (siggy=="3") siggy="SELL";
if (siggy=="4") siggy="STRONG SELL";

and you need to use this at the front of the ea
#define OF_READ 0
#define OF_WRITE 1
#define OF_READWRITE 2
#define OF_SHARE_COMPAT 3
#define OF_SHARE_DENY_NONE 4
#define OF_SHARE_DENY_READ 5
#define OF_SHARE_DENY_WRITE 6
#define OF_SHARE_EXCLUSIVE 7
#import "kernel32.dll"
int _lopen (string path, int of);
int _lcreat (string path, int attrib);
int _llseek (int handle, int offset, int origin);
int _lread (int handle, string buffer, int bytes);
int _lwrite (int handle, string buffer, int bytes);
int _lclose (int handle);
#import "
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #8 (permalink)  
Old 09-28-2008, 03:56 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Interesting matrixebiz,

Not sure I fully understand yet, but I will give it a try.

I've been trying to import a dll created in VB that is installed outside of the mt4 terminal, but I keep getting:

2008.09.27 16:51:46 DLLSample EURUSD,M1: initialized
2008.09.27 16:51:46 DLLSample EURUSD,M1: expert stopped
2008.09.27 16:51:46 DLLSample EURUSD,M1: cannot load library 'C:\WINDOWS\system32' (error 126)


I can't figure out how to take care of error 126, or even what it is. This is very frustrating!

Last edited by wolfe; 09-28-2008 at 04:59 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #9 (permalink)  
Old 09-29-2008, 12:11 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Going to try this example:

Create your own MetaTrader extension (dll) - Part 1 | www.metatrader.info

Article by a great contributer of the forum. CodersGuru.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #10 (permalink)  
Old 09-29-2008, 06:18 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Still not having much luck!

An example of what I need a dll to do:

I want an EA on IBFX server to be able to tell me the bid price of EUR/USD on FXDD server.

Shouldn't be impossible, but can't figure it out yet!

Any ideas?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
matrixebiz


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple charts CiTiFx Metatrader 4 2 10-30-2007 10:21 PM
EA in multiple frame agarwalsharma General Discussion 2 08-07-2007 06:49 PM
How to run multiple Experts tickler General Discussion 1 07-25-2006 12:10 AM
Multiple instances? cubesteak Metatrader 4 5 07-11-2006 01:45 PM


All times are GMT. The time now is 02:29 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.