Discussion of article "Creating Multi-Expert Advisors on the basis of Trading Models"

 

New article Creating Multi-Expert Advisors on the basis of Trading Models is published:

Using the object-oriented approach in MQL5 greatly simplifies the creation of multi-currency/multi-system /multi-time-frame Expert Advisors. Just imagine, your single EA trades on several dozens of trading strategies, on all of the available instruments, and on all of the possible time frames! In addition, the EA is easily tested in the tester, and for all of the strategies, included in its composition, it has one or several working systems of money management.

Author: Василий Соколов

 

Vasily, I honestly expected better. In this opus, you have succeeded in puzzling the reader with the meaning of your proposal.

But you could have called it much simpler - "How to trade Expert Advisors with MQL4 logic in MT5 terminal". And this is what you should pay attention to.
If you had focused on this cornerstone, it would have been much more compact and understandable.

And so, first you loaded with dynamic lists and their application for this particular case. Then with a table of virtual orders.

The whole logic of MQL4 is solved in MQL5 using the functionality of TWO methods!
1. restoration of stop loss and take profit tickets from the terminal history
2. Their further control when one of them is triggered or the main oderer is deleted.

And then, after explaining these two GENERAL functions, move on to dynamic arrays and building "models-mql4-experts".

It is very bad that you did not describe the work with pending orders. although they are no more complicated than market orders. they only delay the placement of real stop-loss and take-profit orders.

For some reason they loaded the reader with useless file <Time.mqh>, with not very beautiful realisations of its functions.

Then functions for order counting, lot control.

It seems that they tried to put all your knowledge of working with experts into the article and buried the very purpose of the article under this growth.

Well, and on the given models - I have not understood how you use stop-loss and take-profit on an order. Neither in IACD nor in Bolinger I have not found the use of stops.

In general, I did not enjoy reading the article. there is a lot of unnecessary weight that buried a bright idea.

Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
  • www.mql5.com
Основы языка / Типы данных / Объект динамического массива - Документация по MQL5
 

Yes, without restoring the list of trades from the account history (or from your own file), it turned out to be a tester's toy.

 
udmurt2:

It is very bad that you did not describe the work with pending orders.

There is work with pending orders, but it is written at the very end of the article. (you probably did not have the patience to read it :)).

In general, the article is really hard to understand. It could be better structured in terms of information presentation.

 

to:Udmurt2

Where do you think the logic of MQL4 experts is in my article? From the review written by you I get an impression of complete lack of understanding of the material. In many respects it is my fault of course, perhaps it really should have been structured better.

--------------------------------

Do you have any specific suggestions for improving the structure of the article?

I agree, a lot of things were left "behind the scenes". Consider this version as 1.0. Here is what is planned to be introduced:

1. Serialisation of data based on data files;

2. Reconstructing the history of model trades by order history;

3. Full description of the model based on pending orders. 4;

4. description of the trading model using a complex system of mutually counted orders. 5;

5. Dynamic control of the efficiency of each model (removal of inefficient models from the list of models).

6. Withdrawal of external functions from trading models, e.g. capital management functions.

7. Multithreading support (partially used now, thanks to MT5 internal parallelisation).

...

As you can see, the material that still needs to be considered is so comprehensive that it is time to write another article on it, the second part so to speak. This article is not a rubber article, in any case, I believe that the tasks I set for myself have been solved. And here Udmurt2 is particularly wrong. The basis of the proposed approach is dynamic lists, not working with pending orders at all (as it seemed to him for some reason). That is why so much attention is paid to them. By and large, there would be no strategy that could not be solved without using pending orders. However, the approach I have proposed does not impose any restrictions on the use of pending orders simulating the same stops and take-outs. However, in this case additional checks and programme subsystems are required, in particular, a structure describing the Trade() event would be very useful. And while there is no such structure (because MQL5 is developing), I consider it a complete madness to write control systems for non-existent possibilities.

By the way, in the simplest case you can write a trade restorer from files in a few hours. However, this issue was not considered in the article, because I want to make this solution well thought out, not just a hastily written one. In any case, it will be one of the many interesting issues to be solved in the second part.

MQL5 is developing now. The proposed approach, as well as MQL5, will also develop over time and gain opportunities. It may seem to some people that at the present stage it is a toy for a tester. In this case, we can say that MetaTrader 5 is also a toy for demo accounts. But believe me, not much time will pass and MT5 will become a de facto standard, and the approach I have proposed will be a powerful solution for multi-currency/multitimeframe/multisystem trading. The main thing now is to understand the basics. These basics are what I have outlined in this article. Once you understand them, you can easily write your own trading model using all the advantages of pending orders and memorising trades in files.

 
Oh, and one more thing. Initially I wrote the proposed trading engine for myself, as I am an active MTS trader. I needed such an engine, so that in the future I could use it in the work on real accounts. Now there are no real accounts and a full-fledged transition to MT5 is yet to come. Therefore, I still have time to think through and implement the necessary functionality within the proposed model required for trading on real accounts. In any case, I believe that due to the high degree of encapsulation and flexible memory management, a high degree of scalability and versatility is achieved. On the basis of the proposed approach it is possible to create a lot of interesting servicing subsystems, such as: a system of efficiency control for each trading model from the list, an individual capitalisation system for each model (already implemented), a system of conditional inclusion/removal of a trading model in the list (if the market has certain formalised properties at which the model is efficient or inefficient, it is dynamically included in the list or removed from it). Moreover, the algorithm can process hundreds of models simultaneously (in the future it is planned to introduce multithreading by standard means). Tell me, what other proposed approach has such flexibility and controllability?
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете - Документация по MQL5
 
C-4:

Where do you think the logic of MQL4 experts is in my article?

open the very beginning and read:

So, here are the main tasks we will need to solve:

  1. An Expert Advisor should trade on the basis of several trading systems at once. At the same time, it should be equally easy to trade both one and several trading systems;
  2. All trading systems included in the Expert Advisor must not conflict with each other. Each trading system must process only its contribution to the aggregate position, and only its orders;
  3. Any of the aggregate systems must be equally easy to trade both on one timeframe of the instrument and on all timeframes at once.
  4. Any of the aggregate systems must be equally easy to trade both on one trading instrument and on all available instruments at once.

and by all these points the logic of MT4 terminal is clearly and absolutely identified

1. it can lead simultaneously several Expert Advisors thanks to the magik and absence of net position.
2. Experts do not conflict with each other thanks to the same magik and absence of net position.
3. Everything is traded on any timeframe
4. Everything is traded on any instrument.

QUESTION:What have you written that is new, which is not in MT4 terminal?

I wrote above that you could build your reasoning from the base of MQL4 and develop its implementation. so it would be much clearer what you want to say.

Do you have any specific suggestions for improving the structure of the article?

I would build it in a step-by-step manner, from accounting for stops by magik-ticket to creating a model of a trading Expert Advisor-mt4
and only then move on to methods of controlling several Expert Advisors. (lists/non-lists is whatever one is in the mood to use)
.

Consider this version as 1.0. Here is what is planned to be introduced:
2. Reconstructing the history of model trades by order history;
3. Full description of the model based on pending orders;
4. Description of the trading model using a complex system of mutually counted orders;

points 2-4 are what you should have solved immediately in this article. everything else is from the evil one. and could have been left to the discretion of the programmer or in the second article.

And here Udmurt2 is particularly wrong. The basis of the proposed approach is dynamic lists, not working with pending orders at all (as it seemed to him for some reason). That is why so much attention is paid to them.
no matter how you look at it, but the basis of this method (your initial tasks and the purpose of this article) is not lists, but spreading MT5 net position on MT4 Expert Advisors' logic and processing their stops via magik-ticket.

dynamic lists are only one of the methods of their control and accounting. you can do with an ordinary array.

Tell me, what other proposed approach has such flexibility and controllability?

any MT4 expert :)))

 

C-4:

It may seem to some people that at the present stage it is a toy for a tester. In this case, we can say that MetaTrader 5 is now also a toy for demo accounts.

Yes, it is ;)

But MT is being finalised. And the code proposed in the article could have been written for real accounts.


By the way, how is the Championship Expert Advisor? Has it suffered from reboots?

 

Vasily, you must be working too hard. Sometimes you need to go back to the beginning and redo everything. I am already convinced for the thousandth time that people tend to complicate everything. My friendly recommendation to you - redo your base classes on the mother logic of MT4 terminal operation with a linear device. A lot of things will become clearer.
Otherwise I will have to write the second article :)

 
komposter:

Yes, it is ;)

But MT is being finalised. And the code proposed in the article could have been written immediately with a view to the real.

By the way, how is the Championship EA? Has it suffered from reboots?


It suffered, but not significantly. Of course, it had a built-in initialisation/deinitialisation event handler. However, I didn't take into account one thing: initialisation and deinitialisation can take place during off hours, for example on Saturday, which is what the championship organisers arranged. This is solved with just a few lines of code, but I just didn't realise about such an insidious combination (well, you can't take everything into account), so somewhere 1 lot was lost.

I will try to write a simple data serialisation in the nearest future and insert it into the article (in principle it will take two days). With it it will be a full-fledged product for work on real-time accounts (demo and real). So you say that this is a toy for a tester. It lacks only 5-6% of the maintenance code for reliable use on real accounts.

We also plan to introduce such a thing: let's say there is an abstract trading model. It uses only pending orders (stops, take-outs, entry points). There will be two ways of using it in the engine: all entry points will be virtual, hidden from the broker's eyes. The second option: all the take stops and entry points will be on pending orders, to increase reliability. It is interesting that for each model there will be two types of virtualisation (pending and virtual). I.e. it will be like this: switch virtual_orders=true; - and all orders are virtual, hidden from the broker's eyes; switch virtual_orders=false; - and all orders become magically pending. The best thing is that no special support will be required from the model, everything will be implemented at the engine level. The models will only need to specify the order type for entry points, the type of stops and takes will be chosen independently, depending on the virtual_orders switch.

Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров - Документация по MQL5
 

to:Udmurt

Please don't tell me what I should have done and what I shouldn't have done. I do not serve your interests and do not work for you.

I consider our conversation to be nonsense, because you do not even fully understand the essence of your own statements. Prove to me that you really understand MQL4 and write a trading expert on it, for example, simultaneously trading 500 different trading models. Let's take 5 strategies * 20 instruments * 5 timeframes as an example. When your Expert Advisor will clearly work on them at least in the tester, then and only then I will admit that the overheated nonsense that you are saying is not really nonsense, but useful remarks of an intelligent person. Now I want to ask you a favour: don't bother me for nothing and don't even try to communicate with me without the source code of this expert.