Discussion of article "Developing a trading Expert Advisor from scratch (Part 24): Providing system robustness (I)"

 

New article Developing a trading Expert Advisor from scratch (Part 24): Providing system robustness (I) has been published:

In this article, we will make the system more reliable to ensure a robust and secure use. One of the ways to achieve the desired robustness is to try to re-use the code as much as possible so that it is constantly tested in different cases. But this is only one of the ways. Another one is to use OOP.

Some things are not so simple, although some people may think so. The order system is one of those things. You can even create a more modest system that serves you perfectly well, as we did in the article Developing a trading Expert Advisor from scratch, in which we created a basic system that can be useful for many people and not enough for others. Therefore, the moment came when everything began to change — this is when the first part of this series about the new order system was born. This can be seen in the article Developing a trading Expert Advisor from scratch (Part 18). This is where we started developing a system that can be managed by the EA while being supported by MetaTrader 5. The idea of the system was to have no limit on orders on the chart. At first, the system seemed rather bold, and I must admit that the very fact of creating a system in which objects would be maintained not by the EA but by MetaTrader 5 seemed rather pointless and inefficient to me.

However, the system was under development and in the article Developing a trading Expert Advisor from scratch (Part 23) we developed a ghost system to facilitate the management of orders, positions or stop levels (Take Profit and Stop Loss). It was very interesting to develop, but there was a problem. If you look at the number of objects used and visible compared to the number of objects supported by MetaTrader 5, you will definitely be surprised, because the number of objects supported will always be higher.

In many cases, the problem is not so serious, you can even live with some moments. But there are two problems that made the system not very stable during periods of high market volatility. In some situations, they forced the user to act incorrectly. This is because when the trader adds a pending order, the system sends it to the server and the server sometimes needs more time than usual to respond. And the system indicates at some moments that there is an order and at other moments it shows that there is no order. And when it was done in positions (see the documentation for the difference between orders and positions)this turned out to be even more cumbersome because it was unknown whether the server executed the command as expected.

There are several ways to solve this problem. Some of them are simpler, some are more complex. Anyway, we must trust the EA, otherwise we should not use it under any circumstances.

Author: Daniel Jose