- Questions from Beginners MQL5 MT5 MetaTrader 5
- How to know there is a deal already executing on a position
- Is there a function that will check to see Order has been closed out due to s/l or t/p
There are different Trade-Transaction-Types: https://www.mql5.com/en/docs/constants/tradingconstants/enum_trade_transaction_type
You can print out all transaction informations and have a look which will occur, before all informations of a closed position are available in the trade history. E.g. In the OnTradeTransaction-Method you can print out the informations of the transactions and the available historical informations of the position.
I think there will be three transactions. The order which shall close the position will be closed (TRADE_TRANSACTION_ORDER_DELETE), the position will be closed (TRADE_TRANSACTION_DEAL_ADD) and the closing order will be added to history (TRADE_TRANSACTION_HISTORY_ADD). The order / sequence can be different. But if all three transactions have occurred, the history should be available.

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use