Dividing open positions into groups - page 8

 
Sergey Voytsekhovsky:

Please tell me, the articlehttps://www.mql5.com/ru/articles/567 has the following code and mentions

But I couldn't find it in the standard package. Not a good search or the article is out of date?

No, I just made a mistake.

You're pulling pieces of code from here, there, and there, and we're supposed to guess.

The code to add an item to the end of the list you showed is very similar to the code to add an item to the end of the list from the standard library.

And it turns out you took something out of somewhere...

 
Sergey Voytsekhovsky:

The idea is clear, it is unclear why not to use ready-proven algorithms, but about "three loops" - very understandable, thank you. When you get high-quality simple solutions, I always wonder why I have not figured it out myself, because it is so obvious. Thank you.

There are a lot of errors there too, and looking for problems in other people's code is absolutely impossible for me. Moreover, if you suddenly find an error, you fix it for yourself and even if you report it, it doesn't mean that they will see the message and fix it. And the next update will start all over again.
 
Alexey Viktorov:
There are a lot of errors there too, and looking for a problem in someone else's code is absolutely impossible for me. Moreover, if you suddenly find an error, you fix it for yourself and even if you report it, it's not sure that the message will be seen and corrected. And the next update will start all over again.

Are you sure there are a lot of bugs in the SB? Or you just don't like cats because you don't have a cookbook?

 
Artyom Trishkin:

No, I just made a mistake.

You are "pulling" pieces of code from here, there, there..., and we have to guess.

The code to add an item to the end of the list you showed us is very similar to the code to add an item to the end of the list from the standard library.

And it turns out you pulled something from somewhere...

The code to add an item to the end of the list is from the standard library, you're right. And I tried to "pull" it after I didn't find that code from the article. :-))

 
Artyom Trishkin:

Are you sure you know that there are many mistakes in SB ? Or just don't like cats due to lack of a cookbook?

Say, Artyom, do you remember the problem with the partial closing of a position? Do you remember that they subsequently added another method instead of finding the reason for this behaviour?

I don't know how deviation=ULONG_MAX made the whole method not work, but I replaced it with deviation=1000 and everything worked fine. I wrote about it in the "Bugs bugs..." thread, but the topic grew so fast that this message dropped into the abyss and was not noticed. As a result, another method appeared, but is it really necessary? And how can one now be sure that there are no errors anywhere else??? How can you be sure that the message will be noticed?

 
Sergey Voytsekhovsky:

The code to add an item to the end of the list is from the standard library, you're right. And I tried to "pull" it after I didn't find that code from the article. :-))

If you use standard library to store your data represented by objects, then the data should not be a structure, but an object based on CObject of standard library, and then you can use dynamic arrays of pointers to objects from standard library to store them. There is no way to pull out a piece.

Документация по MQL5: Стандартная библиотека / Базовый класс CObject
Документация по MQL5: Стандартная библиотека / Базовый класс CObject
  • www.mql5.com
Класс CObject обеспечивает всем своим потомкам возможность быть элементом связанного списка. Кроме того определяется ряд виртуальных методов для дальнейшей реализации в классах-потомках.
 
Alexey Viktorov:

Say, Artyom, do you remember the problem with the partial closing of a position? Do you remember that they later added another method instead of finding the reason for this behaviour?

I don't know how deviation=ULONG_MAX affected the whole method not working, but I replaced it with deviation=1000 and everything worked fine. I wrote about it in the "Bugs bugs..." thread, but the topic grew so fast that this message dropped into oblivion and was not noticed. As a result, another method appeared, but is it really necessary? And now how can one be sure that there are no more errors anywhere??? How can you be sure that the message will be noticed?

No, I don't remember the problem with partial closing. And I don't know about the deviation affecting the operation. And I can't even imagine how a maximum deviation equal to ULONG_MAX points (which is equivalent to no deviation) could affect the partial closure. And I haven't heard about the new method. What is the method?

And to make sure the message isn't lost - find it, copy it into your pocket, and repost it with a note that it must have got lost somewhere in the discussion that"MQL != C++, and should be =="

 
Artyom Trishkin:

No, I don't remember a problem with partial closure. And I don't know about deviation affecting operation. And I can't even imagine how a maximum deviation of ULONG_MAX points (which is equivalent to no deviation) could affect partial closure. And I haven't heard about the new method. What kind of method?

And so that the message was not lost - find it, copy it into a pocket and repost it with a note that somewhere probably got lost in the discussions that"MQL != C++, and should be ==".

Forum on trading, automated trading systems and trading strategy testing

Splitting open positions into groups

Alexey Viktorov, 2020.04.08 09:13

Tell me Artem, do you remember the problem with the partial closing of positions? Do you remember that later they added another method instead of finding the cause of such behaviour?

I don't know how deviation=ULONG_MAX affected the inoperability of the whole method, but I replaced it with deviation=1000 and everything worked fine. In the topic "Bugs bugs..." wrote about it, but the topic grew so fast, that this message disappeared into the abyss and wasn't noticed. As a result, another method appeared, but is it really necessary? And how can one now be sure that there are no errors anywhere else??? How can you be sure that the message will be noticed?


 
Artyom Trishkin:

No, I don't remember a problem with partial closure. And I don't know about deviation affecting operation. And I can't even imagine how a maximum deviation of ULONG_MAX points (which is equivalent to no deviation) could affect partial closure. And I haven't heard about the new method. What method?

And so the message is not lost - find it, copy it into a pocket, and repost it with a note that somewhere probably got lost in the discussion that"MQL != C++, and whether it should be ==".

Are you thus suggesting to push the other messages back? Let no one bring them up? That's not right.

In my opinion, it would be better to define a separate forum section where each problem would be a separate topic. The number of topics is much lower than the number of posts per topic. Therefore, despite the large number of topics, they will not be pushed as far back as individual questions and bug reports are pushed now.

 
Alexey Viktorov:

Do away with the brute forcing of positions to determine "that the position is indeed new". Find another way. For example in OnTradeTransaction. And try to use ArrayRemove function instead of array overflow

If I understand you correctly, this is the right way to go. As a more experienced comrade, please advise, for the purpose of catching newborn positions such a filter will work ??? Or maybe there is a better option ???

void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
 {
     if(trans.type == TRADE_TRANSACTION_DEAL_ADD)
      {
         if(trans.type != TRADE_TRANSACTION_ORDER_DELETE)
            {
             if(HistoryDealGetInteger(trans.deal, DEAL_ENTRY) == DEAL_ENTRY_IN) // открылась позиция
               {
Reason: