Download MetaTrader 5
To add comments, please log in or register
No time to learn MQL5? Order your application from a developer!
sarged
66
sarged 2011.04.19 13:43 
I'm using pedning orders Sell Limit and Buy Limit. I open both orders at once, but if either position has been opened, I have to close another. The problem is i cannot find out wether my pending order has already opened a position or not. Because I send a pending order I can get a ticket number from the order result, but it's status doesn't change. Can you please clarify to me how this procedure can be done?
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
Alexey Da
Moderator
6563
Alexey Da 2011.04.20 10:58  

Would you like to close existing position or to delete existing pending order?

You can try to select order by ticket using OrderSelect function. If your order has already opened position you will receive "false" and _LastError=4754.

Documentation on MQL5: Trade Functions / OrderSelect
  • www.mql5.com
Trade Functions / OrderSelect - Documentation on MQL5
sarged
66
sarged 2011.04.21 03:14  
Well ok, I found out that too, but thanks still.
/
To add comments, please log in or register