Discussion of article "Library for easy and quick development of MetaTrader programs (part XXIII): Base trading class - verification of valid parameters" - page 2

 
Artyom Trishkin:

What is meant by "expert status"?

Suppose I have a TS with 2 indicators, but I trade on one indicator all the time, on the other indicator only 2 times after the start and further I will open orders after the last loss on the 1st indicator.....

it doesn't matter which TS, but a certain TS with which orders are placed according to an independent principle, but the moment of switching on the second TS is important, i.e. multi-expert can be called, or 2 TS in one EA ...

if you overload the terminal, you can complicate the algorithm of searching for starting orders, because we may not know which TS started working first?




as in your large EA, there may be a need to save data, that's why I'm asking, will there be or have there been already written or are there no classes/functions for saving complex data formats?

 
Artyom Trishkin:

the library can.

The same information is not available in the MT4 trading history.

 
fxsaber:

The same information is not available in the MT4 trading history.

Yes, it is not. But there is (at the moment) in the list of events. It is recorded during the Expert Advisor operation. And everything is available in it.

Naturally, after reloading the terminal or restarting the Expert Advisor, the current history of the Expert Advisor will be lost. But this is only for now, because in the future all important elements of all lists will be saved to files and read from them when restarting. Not in the tester, of course.

 
Igor Makanu:

Suppose I have a TS with 2 indicators, but I trade on one indicator all the time, on the other indicator only 2 times after the start and in future I will open orders after the last loss on the 1st indicator.....

it doesn't matter which TS, but some kind of TS with which orders are placed according to the independent principle, but the moment of switching on the second TS is important, i.e. multi-expert can be called, or 2 TS in one EA....

if we overload the terminal, we can complicate the algorithm of searching for starting orders, because we may not know which TS started working first?




as in your large Expert Advisor, there may be a need to save data, that's why I'm asking if there will be or have already been written or are there no classes/functions for saving complex data formats?

I don't really understand to be honest. How can a library know about the logic of an EA that hasn't been created yet? It is intended to facilitate creation of programs for terminals, and it doesn't know at all what programmes will be created with its help.

At the same time, if something is difficult to define programmatically, it is quite likely that it will be easy to do it with the help of the library, and then it will be possible for the expert writer to control everything quickly.

I need not an abstract example to understand itbetter.

 
Artyom Trishkin:

I don't really understand it to be honest. How can a library know about the logic of a not yet created Expert Advisor? It is intended to facilitate creation of programs for terminals, and it doesn't know at all what programs will be created with its help.

At the same time, if something is difficult to define programmatically, it is quite likely that it will be easy to do it with the help of the library, and then it will be possible for the expert writer to control everything quickly.

I need not an abstract example to understand itbetter.

It is enough for you to implement it:

Artyom Trishkin:

Naturally, after reloading the terminal or restarting the Expert Advisor, the current history of the Expert Advisor will be lost. But this is only for now, because in the future all important elements of all lists will be saved to files and read from them when restarting. Not in the tester, of course.

at first glance this is a simple task, but there are a lot of problems: synchronisation with a file, timely recording, logic of recovery after restart..... there are a lot of nuances in which I would like to see the implementation of writing complex data types

 
Igor Makanu:

is enough for you to realise

Naturally, after reloading the terminal or restarting the Expert Advisor, the current history of the Expert Advisor will be lost. But this is only for now, because in the future all important elements of all lists will be saved to files and read from them when restarting. Not in the tester, of course.

at first glance this is a simple task, but there are a lot of problems: synchronisation with a file, timely recording, logic of recovery after restart..... there are a lot of nuances in which I would like to see the implementation of recording complex data types

So this has been planned for a long time - you can say that from the beginning. I will implement it when all necessary data collections will be created - to do everything at once.

But what was written about - that it is necessary to understand when which TC was the first to trade - it does not need such complexity. After all, the library sees the entire history of the terminal from account replenishment to the present time. For MetaTrader4 it is important to resolve the entire history in the terminal. I didn't do it with the help of dll - I plan to provide possible possibilities (pun intended) with standard tools, that's why I didn't consider dll and won't consider it.

Therefore, you can always quickly find all deals of each TS for any time period and compare them. Which deal is the first - that TS and slippers.

 
Igor Makanu:

MQL4 does not store the history of triggered pending orders, you can only define in the history of orders:

I tested this functionality of the library on mql4. History has nothing to do with it, the library catches the very fact of pending order activation and at this moment all properties of an open position are available.

 
Alexey Viktorov:

I tested this library functionality on mql4. History has nothing to do with it, the library catches the very fact of activation of a pending order and at this moment all properties of an open position are available.

Not only at this moment. The history of all triggered orders (and in general - all trading events) is stored in the library and is available throughout the work. That is, you can always find the whole history of a position - from setting a pending order to its complete closing.

However, it is not yet implemented to save the history of the Expert Advisor to a file - after restarting the Expert Advisor, the history of all its trading events will be lost and will start accumulating again after the next trading event. But this behaviour is temporary - initially it was planned to save all important information to files. This will be done later - after creating all the necessary data collections.

CEngine has a method GetListAllOrdersEvents(), which returns to the control program a complete list of all trading events that have occurred on the account since the launch of the library-based programme.

To get the full list of trading events belonging to an Expert Advisor (or its positions with a certain magician), you should filter the obtained list by the necessary magician:

   //--- Get the full list of all trading events on the account
   CArrayObj *list=engine.GetListAllOrdersEvents();
   //--- Leave in the list only events belonging to the expert (or orders) with magik 100500
   list=CSelect::ByOrderProperty(list,ORDER_PROP_MAGIC,100500,EQUAL);

And then in a loop through the obtained list you can get all trade events from the list one by one and work with them.

   if(list!=NULL)
     {
      for(int i=0;i<list.Total();i++)
        {
         CEvent *event=list.At(i);
         if(event==NULL)
            continue;
         Print("----------------------");
         event.Print();
        }
     }
 
Artyom Trishkin:

Not only at this moment. The history of all triggered orders (and in general - all trading events) is stored in the library and is available throughout the entire work. That is, you can always find the entire history of a position - from setting a pending order to its complete closing.

However, it is not yet implemented to save the history of the Expert Advisor to a file - after restarting the Expert Advisor, the history of all its trading events will be lost and will start accumulating again after the next trading event. But this behaviour is temporary - initially it was planned to save all important information to files. This will be done later - after creating all the necessary data collections.

CEngine has a method GetListAllOrdersEvents(), which returns to the control program a complete list of all trading events that have occurred on the account since the start of the programme based on the library.

To get the full list of trade events belonging to an Expert Advisor (or its positions with a certain magician), you need to filter the obtained list by the required magician:

And then in a loop through the obtained list you can get all trade events from the list one by one and work with them.

I said only what is important for me at the moment. And what has been tested. Thank you for the clarifications, when there will be a need I will torment you with questions.

 
Hello! I downloaded the latest version of the library and Expert Part_23, put the visual mode on the tester and market orders are opened, but all pending orders are not, the journal writes "2019.10.23 failed sell stop limit 2.00 RTS-12".
orders are opened, but all pending orders are not, in the journal writes "2019.10.27 10:13:32.157 2019.09.23 10:00:02 failed sell stop limit 2.00 RTS-12.19 at 135750 (135800) sl: 135900 tp: 135600 [Invalid expiration].
Exchange symbols, broker Otkritie, version 5.00 build 2190.
Also. In previous articles, I think in part 14 or 15, you promised to create classes for working with the symbols collection, but why is it so?
with the glass, but for some reason you haven't created them, and these are the basic needs of the library, along with symbols and accounts, and you have gone already

far into library improvements (resources, sounds, etc.) and I think you missed the basic tasks.

Thank you, the library is very much needed.