MT4 DDE - Two Terminals

 
Hi!

I tried running two separate instances of MetaTrader, and getting the DDE supplied data into an excel spreadsheet, but, unfortunately I ran into a nasty problem.
The problem is that both instances register the same DDE name: "MT4", and excel cannot distinguish between them. It seems that I can only get the DDE data from the first MetaTrader that I start - the second one is somehow ignored, or "not seen".
My question, essentially, is: Can I choose a different DDE service name for the second terminal, and if not, what can I do to get DDE from both of the terminals into excel?

Thank you!
 
"and if not, what can I do to get DDE from both of the terminals into excel?"

The file /config/publish.ini has two instances of the string mt4.
I don't see mt4 in terminal.exe or other .ini files or in the registry.

I would experiment with modifications to publish.ini to see what happens,
but, well, that's me.
 
I don't have the MT4 string in my ./config/publish.ini file - it contains mostly zeros and no intelligible ASCII/UNICODE text.
I think that this restriction is deliberate. It takes no more than 10 minutes of coding to add a textbox through which the DDE service name can be changed from MT4 to whatever you like...


"and if not, what can I do to get DDE from both of the terminals into excel?"

The file /config/publish.ini has two instances of the string mt4.
I don't see mt4 in terminal.exe or other .ini files or in the registry.

I would experiment with modifications to publish.ini to see what happens,
but, well, that's me.

 
publish.ini is a binary file, so it looks like junk,yes.

You would need to look at it as such:

$ dump publish.ini
publish.ini:
00000000 9101 0000 0100 0000 0100 0000 3930 3135 ............9015
00000010 3639 3200 0000 0000 0000 0000 6d74 3400 692.........mt4.
00000020 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000030 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000050 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000060 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000070 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000080 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000090 0000 0000 0000 0000 0000 0000 6d74 3400 ............mt4.
000000a0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000b0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000c0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000d0 0000 0000 0000 0000 0000 0000 3139 322e ............192.
000000e0 3136 382e 302e 3634 0000 0000 0000 0000 168.0.64........
000000f0 0000 0000 0000 0000 0000 0000 0000 0000 ................

Addr 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E
-------- ---- ---- ---- ---- ---- ---- ---- ---- ----------------
00000100 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000110 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000120 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000130 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000140 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000150 0000 0000 0000 0000 0000 0000 2f00 0000 ............/...
00000160 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000170 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000180 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000190 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001a0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001b0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001c0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001d0 0000 0000 0000 0000 0000 0000 0500 0000 ................
000001e0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001f0 0000 0000 0000 0000 0000 0000 0000 0000 ................

Addr 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E
-------- ---- ---- ---- ---- ---- ---- ---- ---- ----------------
00000200 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000210 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000220 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000230 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000240 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000250 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000260 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000270 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000280 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000290 0000 0000 0000 0000 0000 0000 0000 0000 ................
000002a0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000002b0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000002c0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000002d0 0000 0000 0000 0000 0000 0000 0000 0000 ................
 
Hi, again, Phy,

I did look at the publish.ini file with a Hex editor and it doesn't, indeed, have any meaningful strings. Here's what my publish.ini has:

00000000:91 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ‘...............
00000010:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000020:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000050:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000060:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000070:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000080:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000090:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000a0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000b0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000c0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000d0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000e0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000000f0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000100:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000110:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000120:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000130:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000140:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000150:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000160:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000170:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000180:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000190:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001a0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001b0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001c0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001d0:00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 ................
000001e0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001f0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000200:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000210:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000220:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000230:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000240:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000250:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000260:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000270:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000280:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000290:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000002a0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000002b0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000002c0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000002d0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

I think that file has nothing to do with DDE. I might be wrong, of course...
Thanks for your help.


publish.ini is a binary file, so it looks like junk,yes.

You would need to look at it as such:

$ dump publish.ini
publish.ini:
00000000 9101 0000 0100 0000 0100 0000 3930 3135 ............9015
00000010 3639 3200 0000 0000 0000 0000 6d74 3400 692.........mt4.
00000020 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000030 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000050 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000060 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000070 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000080 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000090 0000 0000 0000 0000 0000 0000 6d74 3400 ............mt4.
000000a0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000b0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000c0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000d0 0000 0000 0000 0000 0000 0000 3139 322e ............192.
000000e0 3136 382e 302e 3634 0000 0000 0000 0000 168.0.64........
000000f0 0000 0000 0000 0000 0000 0000 0000 0000 ................

Addr 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E
-------- ---- ---- ---- ---- ---- ---- ---- ---- ----------------
00000100 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000110 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000120 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000130 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000140 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000150 0000 0000 0000 0000 0000 0000 2f00 0000 ............/...
00000160 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000170 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000180 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000190 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001a0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001b0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001c0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001d0 0000 0000 0000 0000 0000 0000 0500 0000 ................
000001e0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000001f0 0000 0000 0000 0000 0000 0000 0000 0000 ................

Addr 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E
-------- ---- ---- ---- ---- ---- ---- ---- ---- ----------------
00000200 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000210 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000220 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000230 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000240 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000250 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000260 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000270 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000280 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000290 0000 0000 0000 0000 0000 0000 0000 0000 ................
000002a0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000002b0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000002c0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000002d0 0000 0000 0000 0000 0000 0000 0000 0000 ................

 
Ok. Turns out that was the login/password for the "Publisher" ftp function. Changed them to mt4x in options, and...

$ dump publish.ini
publish.ini:
00000000 9101 0000 0100 0000 0100 0000 3930 3135 ............9015
00000010 3639 3200 0000 0000 0000 0000 6d74 3478 692.........mt4x
00000020 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000030 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000050 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000060 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000070 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000080 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000090 0000 0000 0000 0000 0000 0000 6d74 3478 ............mt4x
000000a0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000b0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000c0 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000d0 0000 0000 0000 0000 0000 0000 3139 322e ............192.
000000e0 3136 382e 302e 3634 0000 0000 0000 0000 168.0.64........
000000f0 0000 0000 0000 0000 0000 0000 0000 0000 ................

Will look some more...
 
Hi, Phy,

Please, don't bother. I've already figured out a way to "circumvent" the problem.
My intention is to bring the attention of the MT developers on the problem, and urge them to, please, add a TextBox via which we can change the DDE service name in MT easily.

Thanks a bunch for all your help, Phy!
 
Ok, I did locate an "MT4" in teminal.exe, but I don't have an editor (yet) that seems to want to play

$ dump terminal.exe | grep -Ei mt4
00020950 79e5 ddeb 3ef3 bed6 22b0 cd54 b444 47bb ye]k>s>V"0MT4DG;

No idea if that would be it.

Good luck with getting anything changed in MT4.
 
did you guys find any solution for that?
 
did you guys find any solution for that?


Hi, taskin,

Unfortunately, I haven't yet been able to find an easy solution for the problem involving DDE, Excel, and 2 or more MetaTrader platforms. I basically gave up...
The hard solution is to use a windows debugger, like WinDBG (the one I use), hook a couple of functions that are used to register and unresgister the DDE service in MetaTrader, use them to find the DDE names, change those names to something unique (MT4, and MT5, for example), and then trivially connect the 2 terminals with Excel.
The problem is not only the extra effort, but also the fact that part of MetaTraders code is altered, which could be considered copyright infringement. That is precisely why I do not use this technique.
 
You can export indicators and prices from MT4 to Excel and execute orders from excel to several MT4s + other cool staff. It is explained here www.fxdialogue.com.
Reason: