Thank you. But this is a workaround and does not solve the problem when there are multiple entries at the same price.
No it's not a workaround, looping thru the history is the only way to do it. Then, it's possible to get the position id of an entry with DEAL_POSITION_ID & use HistorySelectByPosition as you did.
A deal is the reflection of the fact of a trade operation execution based on an order that contains a trade request. Each trade is described by properties that allow to obtain information about it. In order to read values of properties, functions of the Identifier of a position, in the opening, modification or closing of which this deal...
No it's not a workaround, looping thru the history is the only way to do it. Then, it's possible to get the position id of an entry with DEAL_POSITION_ID & use HistorySelectByPosition as you did.
If this is the only way, MQ must be kidding. I don´t know what I should look for in the history, because I don´t have the position ID that I need. What I have is my original position ID, and absolutely no information about the SL, nor vice versa from the SL deal to the original one.
No it's not a workaround, looping thru the history is the only way to do it. Then, it's possible to get the position id of an entry with DEAL_POSITION_ID & use HistorySelectByPosition as you did.
If I am wrong, please tell me. Once again: The only thing I know in my EA is the Position ID. How can I find/identify the corresponding SL deal in the history?
If I am wrong, please tell me. Once again: The only thing I know in my EA is the Position ID. How can I find/identify the corresponding SL deal in the history?
HistorySelect list all the deals, you can filter symbols, profit etc ... and get the position id from there.
THEN HistorySelectPosition will retrieve the list of deals involved in that position. You have to reloop thru.
Doerk Hilger: The problem is, when you executeHistorySelectByPosition(1253268), there are no results, all fields are empty when SL was executed, no close price, close time etc.
If you use HistorySelectByPosition with the POSITION_IDENTIFIER you get nothing? Position identifier is not the same as position ticket.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Thank you. But this is a workaround and does not solve the problem when there are multiple entries at the same price.
Which is which? 3 Positions at different prices, but all closed with an SL at the same price.
Thank you. But this is a workaround and does not solve the problem when there are multiple entries at the same price.
No it's not a workaround, looping thru the history is the only way to do it. Then, it's possible to get the position id of an entry with DEAL_POSITION_ID & use HistorySelectByPosition as you did.
https://www.mql5.com/en/docs/constants/tradingconstants/dealproperties#enum_deal_property_integerNo it's not a workaround, looping thru the history is the only way to do it. Then, it's possible to get the position id of an entry with DEAL_POSITION_ID & use HistorySelectByPosition as you did.
If this is the only way, MQ must be kidding. I don´t know what I should look for in the history, because I don´t have the position ID that I need. What I have is my original position ID, and absolutely no information about the SL, nor vice versa from the SL deal to the original one.
No it's not a workaround, looping thru the history is the only way to do it. Then, it's possible to get the position id of an entry with DEAL_POSITION_ID & use HistorySelectByPosition as you did.
https://www.mql5.com/en/docs/constants/tradingconstants/dealproperties#enum_deal_property_integerIf I am wrong, please tell me. Once again: The only thing I know in my EA is the Position ID. How can I find/identify the corresponding SL deal in the history?
If I am wrong, please tell me. Once again: The only thing I know in my EA is the Position ID. How can I find/identify the corresponding SL deal in the history?
HistorySelect list all the deals, you can filter symbols, profit etc ... and get the position id from there.
THEN HistorySelectPosition will retrieve the list of deals involved in that position. You have to reloop thru.
Use the standard lib for that, it's more convenient, original function are boring to use.
Thank you for your effort.
The problem is, when you execute HistorySelectByPosition(1253268), there are no results, all fields are empty when SL was executed, no close price, close time etc.