Mirroring trades to another MT4 on a same computer?

To add comments, please log in or register
discodave
25
discodave  

Hi,

is it possible some way to mirror automatically all trades made in one MT4-platform to another on a same computer (another account/broker)?

ralphronnquist
420
ralphronnquist  

everything is possible, but some things cost more

Possible, yes; trivial, no.

It's easy enough to get trading signals out of the first MT4, but it's more complicated to get them into the other.

The hobby solution would be to write signals to a file within the first MT4 environment, then have an external script or program that copies the signal data from the file into the second MT4 environment, which would run an EA or script to poll that signal data.

There is a variant of that where you would install the source MT4 within the experts\files directory of the receiver MT4, in which case you don't need the external transfer.

A more professional solution would involve using/writing a dll extension module, or two of those, to achieve send and receive functions over sockets.

There are a fair few technological trolls along this path, certainly enough of them to entice true geeks.

Amritendu Maji
1446
Amritendu Maji  

I think you can use an API to do that. I have no idea how to do it, but taking a wild guess...

on second thoughts, I think I read somewhere that someone was trading OandA using their API and MT4. I can't remember where I read it, but some of the experts like Coders guru and others can tell us if that is possible.

Job M van Zuijlen
93
Job M van Zuijlen  

You can call an external DLL from MetaTrader, so by writing a DLL using the OANDA API you could make calls from within your EA and then place trades with OANDA.

The problem is synchronization: there may be a signal in the MT4 EA, but the order may not be placed for some reason, so you would need to look for confirmation first before you call the DLL. It would be hard to do with anything but market orders; in case of limit or stop orders to trade may be placed on one platform but not on the other. The same with closing orders; if you define a stop, the results may be different between platforms.

Using a file exchange mechanism is not a bad method in itself; TradeBullet works that way and people seem to like it. Also, I'm old-fashioned; I understand files, but not sockets... As Ralph pointed out, the difficulty is that the two MT4 systems cannot share a directory. I don't think putting a second executable in the directory of the first is a workable idea; I would think it would mess up the data, but I may be wrong. If the two MT systems are in different directories, you would need to add a script that copies the files from one directory to the other as soon as a new is "posted". Or, come to think of it, you could write a DLL that places the files where they are supposed to be.

Some time ago, I tried to have Wealth-Lab talk to MT3, using files. It worked to a certain extent, except that Wealth-Lab only gives a signal at the end of the bar, so there was a delay. Also, it seems that I did try to use limit orders, against the reservations I expressed above...

I have an MT3 file that I wrote at the time I can share, it should be possible to convert it to MT4. It is the part that reads the a signal file and does something with it.

The signal file contains lines such as:

300,t0015,GBPUSD,SET_SELLLIMIT,0.1,1.8872,1.8912,1.8859

The fields are: Time, ID, Pair, Operator, Lot Size, Price, Stop, and Target.

But you could of course use any parameters you want. The ID is unique for each signal (I believe).

The code is kind of clever looking it (I must have been smart once!). It reads in the file and because the values are comma-separated you can use a series of read statements so that each value ends up in its own variable. In this case I'm using an area to allow for multiline messages. This may be due to the fact that Wealth-Lab works differently from MT, so an MT to MT set up would be easier.

The operator does the actual work and tells the EA what to do next. The EA is a state machine, which means that it remembers what it has done the last time (such as placing an order). I did this because the underlying engine of MT3 is kind of convoluted with the exits after placing, modifying, or deleting an order. MT4 may be a bit better. Anyway, the secret is using global variables. It's a good idea to add the account number in the name to make them even more unique.

Anyway, I offer this for study and education in the hope that it is useful. I don't really have time to offer support, but I did add some comments to the code! I hope the attachment works...

Amritendu Maji
1446
Amritendu Maji  

Job,

Good to see you around. Haven't seen you in a while. How have you been?

Maji

Job M van Zuijlen
93
Job M van Zuijlen  

Hi Maji,

Trying to stay out of trouble... I work now as a systems analyst and am more busy than before, so there is not much time for trading system development. I try to keep up with what's going on, though. It seems people are making gradual progress. It also seems that MT4 is more stable now. Judging by the number of posts you still quite active yourself!

Job

Ian Smith
1595
Ian Smith  

I was thinking of using MetaTrader + MBTrading as a way to funnel trades from one platform to another. The key issue really is that the brokers all have their own prices and you're never really going to be synchronized (prices won't match but they may be near).

What I considered doing was simply rewriting the EA from MT into MBTrading in pure C++/C#/etc. The annoying part is rewriting the signals, since MBTrading has no signals or charts by default.

What I considered much easier in terms of "Logistical issues" is taking the signal from MBTrading using their client, and then sending the data as a socket over to MetaTrader. In other words, MBTrading would be the server for MetaTrader client.

Job M van Zuijlen
93
Job M van Zuijlen  

daraknor, did you ever look into using the MB Trading API? I looked at EFX Group (which is an FX-only MB Trading), but found the lack of an automated trading platform a disadvantage. There is a Yahoo group devoted to the API, but getting it to work did not seem trivial. In your case, would you have MT4 generate signals based on MB Trading forex data? Would you also have an interface to place orders with MB Trading or would you do that manually?

ralphronnquist
420
ralphronnquist  

My own quest in this area began with a need to take MT4 signals to be played out in VT Trader, and across the Internet.

Ended up as a "signal distribution system" with signal sources using SMTP (email), delivery using SSL, and receiver clients for both VT Trader and MT4.

Plus of course the generic Java signal client base class.

Kept me off the streets for a week or two

MisBHavin
32
MisBHavin  
discodave:
Hi, is it possible some way to mirror automatically all trades made in one MT4-platform to another on a same computer (another account/broker)?

Here is IBFX multi account software. Dont know if it works accross different brokers or just for IBFX accounts. MT has the same software that is not broker dependent and may work accross brokerage accounts. Go to their site and look for it.

Files:
gorinw9
31
gorinw9  

There was a software called "dynastore for metatrader" I believe; and there might be some others too.... They provide feed into metatrader from other providers than the brokers itself...

daraknor:
I was thinking of using MetaTrader + MBTrading as a way to funnel trades from one platform to another. The key issue really is that the brokers all have their own prices and you're never really going to be synchronized (prices won't match but they may be near).

What I considered doing was simply rewriting the EA from MT into MBTrading in pure C++/C#/etc. The annoying part is rewriting the signals, since MBTrading has no signals or charts by default.

What I considered much easier in terms of "Logistical issues" is taking the signal from MBTrading using their client, and then sending the data as a socket over to MetaTrader. In other words, MBTrading would be the server for MetaTrader client.
12
To add comments, please log in or register