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
- Flexible MetaTrader 5 trading system with all order types
- Download the MetaTrader 5 app for iPhone and iPad
- Web version features
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
Well ok, I found out that too, but thanks still.
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