Deal ticket is different from position ticket. To access position ticket you should use:
https://www.mql5.com/en/docs/standardlibrary/tradeclasses/cdealinfo/cdealinfopositionid

Documentation on MQL5: Standard Library / Trade Classes / CDealInfo / PositionId
- www.mql5.com
PositionId - CDealInfo - Trade Classes - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I want to store a position ticket in result of stop order has been filled. I already store the order ticket when opening stop order and when the order is filled I want to update the stored ticket to a position ticket. If I loop all the position and find the position for that symbol and that strategy it will require a lot of resources since it will repeat the loop action every tick. Is there an event handler when the stop order is filled then I retrieve the position ticket and store it?
Update:
I tried to use OnTradeTransaction() but I don't get the result that I want. When I tried printing position ticket the result is different between deal and position ticket.
Log in finding order deal and position ticket.