Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect MetaTrader with a Node.JS?

I'm building a system, based on Node.JS, to connect with MetaTrader and to process all action like link account, open, close trade order...

But I still have not found out the way how to connect with MetaTrader in Nodejs. Can you give me a solution or package examples, that can help me do that? Thanks!

like image 912
Nam Tran Thanh Avatar asked Feb 22 '18 03:02

Nam Tran Thanh


2 Answers

You can try MetaApi https://metaapi.cloud cloud service which provides REST API and WebSocket API access to both MetaTrader 4 and MetaTrader 5 accounts.

Official REST API documentation: https://metaapi.cloud/docs/client

SDKs: https://metaapi.cloud/sdks (javascript, python and Java SDKs are provided as per April 2021)

It supports reading account information, positions, orders, trade history, receiving quotes, and accessing market data.

The service also provides copy trading API https://metaapi.cloud/docs/copyfactory and API to calculate forex trading metrics on a MetaTrader account https://metaapi.cloud/docs/metastats.

Update: as of mid Mar 2021 MetaApi allows limited API testing without adding a payment method

like image 114
roman Avatar answered Oct 18 '22 07:10

roman


Observation:

MetaTrader software suite has multiple parts, only one of which is a customer-facing one - the MetaTrader Terminal 4/5. This terminal software communicates with MT4/5 Server and there are many other, additional Broker-side MetaTrader suite, server-cooperating systems.

Given your indication above, you seem to plan for Node.JS functional integration with MetaTrader Terminal piece of software.

Limitations:

As clarified above, the MetaTrader Terminal 4/5 software platform is the subject of interest and before technical steps are taken, a validation ought take place, so as to confirm, whether programmable features and services, natively supported inside MT4 Terminal are covering all you needs or not.

Given the MT4 Terminal has a programmable ecosystem for both for automated processing and for semi-automated back-testing, these two principal directions do not provide the same level of comfort for integration with an external cooperating logic or event-flow.

Given you project needs are not met with the built-in native MQL4/MQL5 code-execution environment, your further approach will have to be mixed with some GUI-manipulating assistive technologies, which may help to cover the gaps detected in the functional mapping pre-validation phase.

Approach:

For the purpose of making the MT4 Terminal code-execution ecosystem to cooperate with external worlds, there is a built in ability to #import extending features, not present in the native MQL4/5 language via DLL-s.

Having received this freedom of design, the user-code in the MQL4/5 language can borrow all missing features and services available for such integration projects.

Both Node.JS and MetaTrader Terminal 4/5 can use ZeroMQ and/or nanomsg for a fast and productive integration of a heterogeneous distributed system, which seems to be a match for your indicated needs.

Feel free to read other posts here and here, about signalling/messaging function-plane concepts, used for the sake of this very kind of system integration.

like image 33
user3666197 Avatar answered Oct 18 '22 07:10

user3666197