Thank you so much!
To do this, the socket Expert Advisor should be placed on the charts of those currency pairs for which you want to collect tick information.
Not the most elegant solution. But I am ready to listen to suggestions on how to improve the project.
For MT4 it seems clear how - through DDE server, but how on MT5 I ask everyone.
Maybe someone has some ideas ?
For MT4 it seems clear how - through DDE server, but how on MT5 I ask everyone.
Can anyone have any ideas ?
It all depends on the advancedness of the server, the complexity of the network protocol and the task to be performed....
First you need to define the task, then develop a network protocol (it may be necessary to work out the structure of the server database).
It all depends on the advancedness of the server, complexity of the network protocol and the task to be performed....
First you need to define the task, then develop a network protocol (you may need to work out the structure of the server database).
If you have patience, I will finish the File Mapping data exchange project. It will be just what you need.
If you have the patience, I will finish the File Mapping data exchange project. It will be just what you need.
Will I have to set up an Expert Advisor for each pair I want to receive data on?
I have not yet done the transfer of quotes the way MT4 does via DDE, because MT4 is an automation server. I do it this way: MT5 is a client, and if you want to know the current_prices, you send a request and get the result. This works for all currency pairs active in the market view window.
You can also in this project send all quotes in one package. For example, in an Expert Advisor, on a timer every second, receive data and check before sending that the new data is not similar to the already sent data, for each currency pair, i.e. a change in the data for Ask or Bid will be considered a new tick.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Working with sockets in MQL5:
This library will allow you to tranfser realtime quotes from MetaTrader 5 to external server application.
The TCP protocol is used, it allows to transfer the data not only locally, but globally all over the Internet. The Winsock2 library (ws2_32.dll) is used for working with sockets. The direct calls of the library functions is impossible, because MQL5 doesnt allow to work with pointers and pass complex data structures as parameters of DLL functions. The library socket_mql5.dll, written in C++, is an intermediate wrapper, connecting the Expert Advisor and sockets library.
The interaction of MetaTrader 5 with external server application is presented at Fig:
The minimal set of the functions for one-way transfer (SocketOpen, SocketWrite, SocketClose) is implemented in socket_mql5.dll library.
An example of an Expert Advisor, connected to server and used to transfer the realtime tick data to external server application is included.
The archive contains:
Author: Andrey Voytenko