Discussing the article: "Developing a Replay System (Part 36): Making Adjustments (II)"

 

Check out the new article: Developing a Replay System (Part 36): Making Adjustments (II).

One of the things that can make our lives as programmers difficult is assumptions. In this article, I will show you how dangerous it is to make assumptions: both in MQL5 programming, where you assume that the type will have a certain value, and in MetaTrader 5, where you assume that different servers work the same.

When the EA is located on the chart, it will inform about the type of account detected. This is important in order to know how the EA should act. But although this works very well, when the system is run on a chart of on a REAL or DEMO account, the system does not use what controls the replay/simulation system, and does not report the type of account to which the asset belongs, but rather the type of account on which the platform operates. This problem, although small, does cause us some inconvenience.

You might think that the solution to this problem is not complex or even difficult, it is very simple. Let's make sure that the replay/simulation system somehow tells you which account type is correct. This of course depends on the asset used. In fact, this idea is simple. But let's put it into practice - this will be another story. The truth is that getting the replay/simulation system to tell us which account type to use is not that easy. But fortunately, the MetaTrader 5 platform offers us the opportunity to implement a solution that is adequate and plausible for the actual use.

However, we will not do this in a reckless way. We will implement the solution in a certain way that will prevent certain things on certain account types. This information will be important for us when creating an order system. First, let's think about what we are talking about. The replay/simulation system will be able to use assets from different markets. It means that we can use assets which imply NETTING or HEDGING account types.

Author: Daniel Jose

Reason: