Iason
Iason

Reputation: 249

How to pass data from MQL4 to C# DLL

I would like to ask how to pass some kind of data, like string to my C# DLL. This questions has been answered for C++: How to pass argument by reference from MQL4 to C++ DLL

However in my case I want my C# code to get this value from MQL4 and then do something with it (so all this while in the C# code).

It's probably a similar approach, but is this still the best way to go, and could someone provide a minimum example of doing this in C#?

Upvotes: 2

Views: 1662

Answers (1)

user3666197
user3666197

Reputation: 1

The Best Way to go?

My one would be to integrate "over" a principally neutral ZeroMQ channel.

MQL4 will sit on one side, C# or whatever other process ( python, GoLang, Erlang, FORTRAN, MATLAB, ... ) will sit on remote side, each agent-side having a chance to have also an N+M load/balancing or robustness resilience added.

Using the same byte-packing mapper on either side will enforce interoperability, even if MetaTrader Terminal platform will make any next shift of paradagms ( as it did in past, having moved string datatype into actually being a #pragma-decorated struct and similar low level surprises ).

This way one will never have to re-visit the API for any external re-factoring introduced implementation revision for gaining the lost integration back into production.


Minimum Example of doing this?

Feel free to study and re-use many of ZeroMQ examples posted here or the ZeroMQ API documentation and the C# bindings available.

Upvotes: 2

Related Questions