Position Closed block MT5 not working
-
Position Closed block on MT5 not working on OnTrade tab
Please help. -
Sadly it is a know bug the admin has not fixed yet. You can fix it temporarily by using a 'For each closed position' block immediately below it.
-
Thank you. Using 'For each closed position' worked for the purpose
-
I'm glad it worked for you, but you must be careful not to define the groups of operations, so that they are recognized among themselves. My recommendation would be to define the groups and keep them separate. http://fxdreema.com/forum/post/102771

-
Thank you @realjoker, I was aware of that, my groups are defined
-
At this point I'm convinced that even MetaQuoted don't know what they are doing with their Positions/Orders/Deals functions.
This bug happens in a code that I rewrote months ago. I was very careful to write everything properly, and I believe I did. I also made some tests to ensure that everything is good, and it was.
Since then, I didn't touch any MQL5 code, so this bug (and possibly other bugs) is introduced after some of the newest MT5 builds.
I wanted to explain what the problem is and why I think it makes no sense, but I think it's too complicated and maybe no one even cares.
But in short, now it seems that when we want to use for example this function:
long HistoryDealGetDouble( ulong ticket_number, // Ticket ENUM_DEAL_PROPERTY_DOUBLE property_id // Property identifier );... first we have to use this one to select the deal:
bool HistoryDealSelect( ulong ticket // Deal ticket );... which is crazy, because why do we have this
ticket_numberproperty inHistoryDealGetDouble(), if not to select the deal and get whatever data we need?It's probably the same mess with
HistoryOrderGet...functions.One way for me to fix this is to scan the code I wrote for any usages of
HistoryDealGet...andHistoryOrderGet...functions, and put someHistoryDealSelect()andHistoryOrderSelect()functions on top. Then hope to remember in the future that I have to do every time, because it's not intuitive at all.And the other way is to write overloads for all
HistoryDealGet...andHistoryOrderGet...functions without theticket_numberproperty. But then if MetaQuotes decide to to the same, there will be errors. -
I did some fixes in many files, I hope it is ok now. If there were similar bugs in other blocks, maybe I fixed them as well.
-
Thank you for your efforts
-
Thank you very much for the explanation.
-
@fxDreema thanks for the fix.
Just a small item that maybe you could tidy up.
The problem can be seen in the code screenshot below declaring orderTicket as an 'int' at line 23,205.
This generates a "possible loss of data due to type conversion from 'long' to 'int'" compiler warning.
As can be seen in the same screenshot below in line 23,213 it is declared as a 'ulong' and that does not generate a warning.
If my understanding of the MQL5 documentation is correct it should be at least declared as a 'long'.Thanks in advance and cheers!!
