Discussing the article: "Market Simulation (Part 09): Sockets (III)"

 

Check out the new article: Market Simulation (Part 09): Sockets (III).

Today's article is a continuation of the previous one. We will look at the implementation of an Expert Advisor, focusing mainly on how the server code is executed. The code given in the previous article is not enough to make everything work as expected, so we need to dig a little deeper into it. Therefore, it is necessary to read both articles to better understand what will happen.

In the previous article Market Simulation (Part 08): Sockets (II), we began developing a practical application that makes use of sockets. The goal was to demonstrate the use of this tool in programming oriented toward MetaTrader 5. It is true that MQL5 does not allow us to create a server directly using pure MQL5. However, since the use of sockets is independent of any particular language or even the operating system, we can still use them in MetaTrader 5 by implementing the programming in MQL5.

However, due to internal reasons of the MetaTrader 5 platform itself, we cannot use indicators together with sockets. Or, more precisely: we cannot place calls to socket-related procedures inside an indicator code. The reason for this is that, if this were possible, we could freeze or compromise the performance of the calculations performed inside indicators.

Nevertheless, nothing prevents us from still using indicators for other purposes. And that is exactly what we did in the previous article, where we created our entire mini chat, including the controls and the text panel, inside an indicator. The details created and placed in the indicator do not interfere in any way with the execution flow of indicators. But without using an indicator, it would be quite complicated to create what was done in the previous article, because we would end up interfering with some area of the chart of the asset being plotted.


Author: Daniel Jose