Ticket should be an one of a pending (working) order. It might not be a ticket of triggered order. How do you get this ticket (show your code)?
Hi,
You specified the wrong action,
mrequest.action = TRADE_ACTION_REMOVE;
This is used for deleting pending orders and not for closing opened positions.
To close an open position, you need to specify your action as:
mrequest.action = TRADE_ACTION_DEAL;
Also, you will close an opened position with a trade in the opposite position. For example, if you opened a BUY, you will close it when you a open a SELL and vice versa.
Thank you, so I have a misunderstanding ..
once I place an order (buy or sell), I can conclude with the sale or purchase again."Position close" is only valid for orders not yet executed.
That was very helpful to me.
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 am a beginner with Metatrader. In the past I worked with Deal Book in the Forex market.
My question should be easy to answer for you:
I have a function "close position" created. I get when calling the function the following error message:
failed cancel order # 52 buy at 00:00 0.00000 [Invalid request]
Return: 10013; Last ticket: 52
Can someone help me? I set all the parameters right? The ticket number is generated on the purchase / sale of the order (ticket = mresult.order;).
Thank you!
dee544