Discussing the article: "Developing a Replay System (Part 26): Expert Advisor project — C_Terminal class"

 

Check out the new article: Developing a Replay System (Part 26): Expert Advisor project — C_Terminal class.

We can now start creating an Expert Advisor for use in the replay/simulation system. However, we need something improved, not a random solution. Despite this, we should not be intimidated by the initial complexity. It's important to start somewhere, otherwise we end up ruminating about the difficulty of a task without even trying to overcome it. That's what programming is all about: overcoming obstacles through learning, testing, and extensive research.

You may have already noticed that I'm a big fan of object-oriented programming (OOP). This is due to the rich capabilities provided by OOP. It also provides a way of creating robust, secure and reliable code right from the start. To begin with, we need to get a preliminary idea of what we will need by organizing the structure of the project. Having experience as both a user and a programmer, I realized that for an Expert Advisor to be truly effective, it must use the resources that are always available to us: the keyboard and mouse. Given that the MetaTrader 5 platform is based on charts, using the mouse to interact with graphical elements is essential. But the keyboard also plays a key role in helping in various aspects. However, the discussion goes beyond the use of a mouse and keyboard, which will be covered in the automation series. In some cases, full automation can be accomplished without these tools, but when choosing to use them, it is important to consider the nature of the operation being performed. Thus, not all Expert Advisors are well suited for all types of assets.

This is because some of the assets have the price movement of 0.01. Others may have 0.5, while some may also have 5. In the case of Forex, these values differ significantly from the examples mentioned. Because of such diversity of values, some programmers choose to develop EAs specifically for specific assets. The reason is clear: the trading server does not accept arbitrary values; we need to adhere to the rules set by the server. The same principle applies to the replay/simulation system. We cannot allow the EA to execute orders with random values.

The introduction of this restriction is not only necessary, it is extremely necessary. There is no point in having functional replay/simulations for training if the system behaves completely differently when trading on a real account. It is therefore important that the system maintains a certain standardization and that it adapts as closely as possible to the reality of a real account. Therefore, it is necessary to develop an EA that will work as if it were directly interacting with the trading server, regardless of the circumstances.

Author: Daniel Jose