Domanda

I have a task of migrating a C# market strategy to MetaTrader.

  1. Is there any way to automate that job? (For example, is it possible to parse C# into it's AST, then make the translation?)

  2. Does MetaTrader accept other languages by any means?

È stato utile?

Soluzione

Approach the task Bottom-Up -- Architecture-wise

Yes, you can simplify the trouble and make MT4 become a Node, which is immediately connected peer-to-peer to your current C# Market Strategy.

This alowed me to operate a cluster-based computing communicating massively parallel with a crowd of MT4 nodes.

MT4 can become anEventFEED-er Node via a more complex "Scaleable Formal Cummunication Framework" in a very intelligent manner.

Do you wish to have a CLI-interface to command your MT4 node(s) -- one as anEventFEED-er, another as anXtoACTOR Node -- selectively, with a syntax & grammar of CLI-instructions ( not speaking about test-automation et al ...)?

Do you wish to have a central <syslog> daemon to off-load HFT-traffic loaded MT4 node(s) and automate + administer scripted monitoring & maintenance tasks?

Do you wish to have an external GPU-computing engine/cluster to communicate in a Client/Server manner with MT4 EA on a per-tickEvent basis?

ZeroMQ and/or nanomsg frameworks will allow you to design and develop many-to-many ( node-network-wise ) & any-to-any ( implementation language-wise ) systems.

MT4/MQL4 has a direct smart wrapper for ZeroMQ >>> thanks to Austen Conrad on GitHub MQL4ZMQ

ZeroMQ >>> thanks to it's great team has many language bindings - C/C++, Python, Java, R, even Erlang, ...

So your Project may jump start on rock solid grounds & independent of any particular architecture gridlocks ( DLL moving sands et al )

Engineering built-ins save you a lot of time and efforts and avoid re-inventing wheel

Altri suggerimenti

How about GET/POST requests and a web based text API service?

You could use your C# strategy to update a web based text file with a ternary signal:

-1 SELL
 0 HOLD
 1 BUY

Then use MQL4 to read the text file once a minute for a trade signal.

As far as technically how to do this; unfortunately I'm a python programmer not MQL4 or C#, so I can't help.

Yes, it's possible to use C# by using some 3rd party solutions like NQuotes http://www.nquotes.net/ , which is essentially a ready-made DLL for a general usage (like Dmitry said, you can create your own, but it involves a bit of work).

short answer is no, however, there is a faculty in mql to import dlls. so you could wrap your c# lib with a c++/cli lib that exposes functionally via function exports, you could even run a timer in mql and implement a rudimentary message pump.

Update: MT4 can only access standard calls of unmanaged DLLs. the reason you have to use a c++ wrapper is that c++ DOES have the capability to create unmanaged standard calls. any other language that you can create standard calls with can also work.

Furthermore you need a wrapper just in case you want to use other languages which does not support standard calls. You may just write your entire code in c++ and the whole wrapper concept will be obsolete.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top