API Documentation and example PHP code

This API is easy to use. Just follow the instructions given below exactly and you will start receiving the trading history for your MT4 or MT5 accounts immediately. No money required to test.

IMPORTANT: Example PHP code is given below. Make sure you read carefully how to encode the investor password before calling the API and how to find trade server to be passed. Rest of the items are straightforward.

 

 

 

Input parameter Description Possible values

[USERID]

This is the userid that you want to tag with this MT4 account's data history. This is a unique identifier available to you to use in your project for any specific purpose you might have. If you don't need this parameter you can leave it blank or not send it as part of the API call. Alphanumeric value. No special characters allowed.

[APIKEY]

This is the API key that is unique to you. You can get this by creating a free account here. Note that all new accounts get free API quota of 1000 calls so you can test the interface. Once you successfully create an account, your API key will be made available in your members area. A randomly generated alphanumeric value.

[ACCOUNTNUMBER]

This is the MT4 account number for which you need to read the trade history. Any numeric value. If any characters other than numbers are found, API will return an error message.

[TRADESERVER]

This is the trade server of the broker where the account has been created. Be careful with this one as it must be the actual address of the server - not the one you see in the login box when you try to login to your MT4 account. More help is available by clicking on the help link in the form above or in the FAQs section. Alphanumeric value in the form of a web address that can be resovle successfully to an IP address or the IP address itself. Must have the port number in the address. Usually port number is 443.

[INVESTORPASSWORD]

This is the investor password for the trade account. Very important: Investor password must be converted to hexadecimal string before passing to the API. In PHP, this is the function bin2hex(). Most of the coding languages have equivalent of this. If this is not done, the API will not work. Hexadecimal representation of the alphanumeric string.

[CHARTSUFFIX]

This is the suffix your broker may be using for charts in your trading account. For example, usually the pair USDCHF is available to trade as USDCHF but in some brokers, they add some small set of characters at the end - e.g. USDCHFm. Notice that "m" in the end. That is the chart suffix. More information is available in the FAQs section. Alphanumeric value.

[LASTTICKET]

This is the ticket number from which you wish to read the value. More information is available in the FAQs section. Numeric value. If a non-numeric value is used, API will return an error.

[PLATFORM]

This is the platform indicator - MT4 or MT5 Must be all capital letters MT4 or MT5 depending on which platform the account is running on.

 

 

 

PHP code example:

 


footer-frame