API interface

 

Hello everyone. I know that mt4 and mt5 are platforms and they don't have APIs, but I wonder how I can do the following thing:


Given the account ID of a user which has an account opened with a X broker and uses MT4 or MT5, and the related password, how I can read all the account informations like the history of the orders? The account current equity or balance etc? This is something possible for example with cTrader and their APIs, but I wonder how I can do the same thing here.

For example, Myfxbook provides this sort of service and I would like to do it by myself for me and my friends. Thank you.

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Account Properties - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
ElGuapo: Hello everyone. I know that mt4 and mt5 are platforms and they don't have APIs, but I wonder how I can do the following thing: Given the account ID of a user which has an account opened with a X broker and uses MT4 or MT5, and the related password, how I can read all the account informations like the history of the orders? The account current equity or balance etc? This is something possible for example with cTrader and their APIs, but I wonder how I can do the same thing here. For example, Myfxbook provides this sort of service and I would like to do it by myself for me and my friends. Thank you.

That is done by using the back-end broker side of the MetaTrader services, not the client side terminal software.

On MT4, I believe it was possible to use that service to connect to multiple brokers, and that is probably what MyFXBooks uses.

However, I am guessing that on MT5, it might not be possible for the back-end to allow connecting to multiple brokers (only one's own licensed broker ID), and that is probably why MyFXBook does not cater for MT5 accounts.

EDIT: For MT5, you could maybe use the client terminal's Python API, but you will only be able to connect to one account at a time per terminal.

 
As far as i understand, mxfxbook require you to run their EA in your terminal. This EA gathers data and send it to myfxbook.
 
Enrique Dangeroux #: As far as i understand, mxfxbook require you to run their EA in your terminal. This EA gathers data and send it to myfxbook.

That was several years back. Nowadays they have access to the account history directly, given the broker, account number and investor password.

 
Fernando Carreiro #:

That is done by using the back-end broker side of the MetaTrader services, not the client side terminal software.

On MT4, I believe it was possible to use that service to connect to multiple brokers, and that is probably what MyFXBooks uses.

However, I am guessing that on MT5, it might not be possible for the back-end to allow connecting to multiple brokers (only one's own licensed broker ID), and that is probably why MyFXBook does not cater for MT5 accounts.

EDIT: For MT5, you could maybe use the client terminal's Python API, but you will only be able to connect to one account at a time per terminal.

Thank you Fernando for your reply! Just to have more clarifications. " That is done by using the back-end broker side of the MetaTrader services" . Is there any sort of official documentation to do that? I know that it is also possible with mt5 because there are some third party web sites that allows to do that also with Mt5, but I'm struggling finding documentation or forums or something about this topic. 


Thank you so much for your time

 

Most likely these are server plugins provided by these service providers. You will not have access to it nor find any info because it is not public.

Your best bet is the poor man's api and that is the - EA/indicator sending info to server - route.

 
Enrique Dangeroux #:

Most likely these are server plugins provided by these service providers. You will not have access to it nor find any info because it is not public.

Your best bet is the poor man's api and that is the - EA/indicator sending info to server - route.

I don't agree with that, because I tried one of these services and I don't have any  EA/indicator sending info to server

 
ElGuapo #: I don't agree with that, because I tried one of these services and I don't have any  EA/indicator sending info to server

That is not what @Enrique Dangeroux stated. It did not say that those services use EAs. He stated that YOU as a normal user will have to to use EAs for a "poor man's alternative".

Those other services probably licensed the back-end from MetaQuotes and if you want to use that back-end you would also have to license it from MetaQuotes.

MetaTrader 5 trading platform for brokers and banks
MetaTrader 5 trading platform for brokers and banks
  • www.metatrader5.com
Do you want to start a brokerage business? The MetaTrader 5 multi-asset institutional platform is the best solution for you! With the MetaTrader 5 platform, you can run your brokerage business in various financial markets including forex, stock exchange and Futures markets. MetaTrader 5 is a full-cycle platform that includes all elements that a...
 
Ok, sorry but a point is still unclear to me.
Just suppose to limit our scope to mt4, you said that it may be possible through back-end broker api.
I found the base page about mt4 api existence but cannot find anything about how can i access APIs and/or some documentation about them.
Can you point me out to it?

Even for your latest comment "license it from Metaquotes" there's any page with some more detailed information about what its available on mt5 side API? 
 
ElGuapo #: Ok, sorry but a point is still unclear to me. Just suppose to limit our scope to mt4, you said that it may be possible through back-end broker api. I found the base page about mt4 api existence but cannot find anything about how can i access APIs and/or some documentation about them. Can you point me out to it? Even for your latest comment "license it from Metaquotes" there's any page with some more detailed information about what its available on mt5 side API? 

The MT4 API is only available to those that licensed it from MetaQuotes, like MT4 brokers and such. It is not available to retail traders and users of the MT4 client terminal.

Just accept, that unless you have the qualifications and the money to be able to license the back-end from MetaQuotes, you are not going to be able to use it for your project.

Reason: