0
votes

I am trying to build a build a platform where in the user enters data and that data is sent to the MT4 platform. Trades are to be done based on these data. Simultaneously i need updates about the trades happening at my platform from the MT4 platform. I dont know anything about how to do it. So any help would be appreciated.

1

1 Answers

0
votes

I would choose sockets as the way to do it. It requires DLL. I think the best lib can be downloaded here, or you may take that one and update a little to compress and get rid of some MQL4/5 scenarios.

Implement OnChartEvent() in your expert advisor to receive updates from the sockets.

Think of initial synchronization (some deals may be opened, and some pending orders might be placed when your EA starts - think of that scenario carefully, probably place pending orders and those market that are in red, or choose another scenario). For that, make sure your socket server (written in Python, Java or any other language that you know, you may find better examples) accepts some key word to return all the actual data, and that you keep such data.

If you need to pass some data from MT4 to your application, sockets can work too, alternative is to implement a REST service in your application and send data from MT4 using its WebRequest function.

If you need to copy trades received from the server, look for some examples of trading copiers to understand how it should work.