darwinex / dwx-zeromq-connector

Wrapper library for algorithmic trading in Python 3, providing DMA/STP access to Darwinex liquidity via a ZeroMQ-enabled MetaTrader Bridge EA.
https://blog.darwinex.com/zeromq-interface-python-r-metatrader4/
BSD 3-Clause "New" or "Revised" License
341 stars 227 forks source link

[RESOLVED] Error in adding DWX_ZeroMQ_Server_v2.0.1_RC8.mq4 to MT4 #38

Closed daralucky closed 4 years ago

daralucky commented 4 years ago

Hello,

I have a problem loading the EA into MT4.

When I check the EA code in MetaEditor I found one error on line 199 as follows:

'&' - parameter passed as reference, variable expected DWX_ZeroMQ_Server_v2.0.1_RC8.mq4

Please have a look into this.

Thanks

tfmf commented 4 years ago

same here, strangely this was working on a previous version of MT4

tfmf commented 4 years ago

Changing this:

InterpretZmqMessage(&pushSocket, components); to: InterpretZmqMessage(pushSocket, components);

will fix it, not sure what the implications are

tfmf commented 4 years ago

maybe @integracore2 can share some light here

daralucky commented 4 years ago

I tried that even before posting this thread.

The implication is that you won't receive any message from MT4.

For example, you won't receive any opening trades information or you won't receive a response after you open a new trade.

tfmf commented 4 years ago

Try to request a market symbol price and see if you get a response

simeon-vanov commented 4 years ago

Same here, after the last version build from 10 September the code is no longer working. I guess I will have to find a broker that accepts direct API communication. As working with the terminal of MetaTrader is hacky anyway

integracore2 commented 4 years ago

Hi @daralucky @tfmf @simooo93,

With the latest MT4 Build 1212 (10 Sep 2019), there appears to have been an update to passing variables as references to functions.

I was unable to locate this in the Release Notes though.. (link to release notes)

I can confirm that removing the & from the call to InterpretZmqMessage indeed fixes the issue as regards compilation.

I have just tested connectivity between Python and MT4 (build 1212, 10 Sep 2019) with the recompiled EA and cannot reproduce the no-response behaviour as reported by @daralucky

Could others please confirm if they are also experiencing no response from MetaTrader when using a recompiled version of the EA with the reference fix as discussed above?

Output in IPython console after recompiling EA as above:

_zmq = DWX_ZeroMQ_Connector()
[INIT] Ready to send commands to METATRADER (PUSH): 32768
[INIT] Listening for responses from METATRADER (PULL): 32769
[INIT] Listening for market data from METATRADER (SUB): 32770

_zmq._DWX_MTX_GET_ALL_OPEN_TRADES_()
{'_action': 'OPEN_TRADES', '_trades': {}}
patlachance commented 4 years ago

I confirm that Metaeditor version 5.00 build 2138 06 Sept 2019 fails to build DWX_ZeroMQ_Server_v2.0.1RC8.mq4 with the following error message '&' - parameter passed as reference, variable expected_

Even if removing the '&' solve the compilation issue, it doesn't produce a working EA.

I had to revert back to Metaeditor version 5.00 build 1966 20 Sept 2018 to compile it successfully and get the EA to send message to external python script.

integracore2 commented 4 years ago

I confirm that Metaeditor version 5.00 build 2138 06 Sept 2019 fails to build DWX_ZeroMQ_Server_v2.0.1RC8.mq4 with the following error message '&' - parameter passed as reference, variable expected_

Hi @patlachance ,

DWX_ZeroMQ_Server_v2.0.1_RC8.mq4 is an MQ4 file, and hence cannot be deployed in MetaTrader 5.

MQ4 and MQ5 are not interchangeable, meaning it is not possible to deploy an MQL4 program directly in MQL5 without modifications to make it MQL5-compliant.

We are currently testing an MQL5 version that will be made available as soon as we've completed our tests.