Discussion of article "Developing a trading Expert Advisor from scratch (Part 19): New order system (II)"

 

New article Developing a trading Expert Advisor from scratch (Part 19): New order system (II) has been published:

In this article, we will develop a graphical order system of the "look what happens" type. Please note that we are not starting from scratch this time, but we will modify the existing system by adding more objects and events on the chart of the asset we are trading.

If you think that this is not easy to implement, take a look at the following code part of the C_HLineTrade class:

inline void SetLineOrder(ulong ticket, double price, eHLineTrade hl, bool select)
{
        string sz0 = def_NameHLineTrade + (string)hl + (string)ticket, sz1;
                                
        ObjectCreate(Terminal.Get_ID(), sz0, OBJ_HLINE, 0, 0, 0);

//... The rest of the code.... 

The highlighted part shows exactly that we can create as many horizontal lines as we want, and they will receive events in a completely independent way. All we need to do is to implement events based on the name that each of the lines will have, since the names will be unique. The MetaTrader 5 platform will take care of the rest. The result will look something like this:


Although this already seems like something ideal, this modeling will not be enough to achieve the result we really need. The idea can be implemented. But the data modeling currently available in the EA is not ideal, because we cannot have an unlimited number of objects based on one name. We need to make some changes that require a fairly deep code modification.

Author: Daniel Jose