request.position = 0; // t_buy.RequestPosition();
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
- www.mql5.com
Trading is done by sending orders to open positions using the OrderSend() function, as well as to place, modify or delete pending orders. Each trade order refers to the type of the requested operation. Trading operations are described in the ENUM_TRADE_REQUEST_ACTIONS enumeration...
Hi,
I wasn't able to understand your reply... AFAIK the OP wanted to set a pending order opposite to the opened position to sell part of its volume as a partial take profit strategy, all this in hedging mode. But your reply linked to a way of using MqlTradeRequest, with TRADE_ACTION_CLOSE_BY, that is supposed to be used to close the position entirely - even the example of the provided link don't consider the value informed in .volume.
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
- www.mql5.com
Trading is done by sending orders to open positions using the OrderSend() function, as well as to place, modify or delete pending orders. Each trade order refers to the type of the requested operation. Trading operations are described in the ENUM_TRADE_REQUEST_ACTIONS enumeration...
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 all,
Is it possible to do this?
I'm opening a position with a order like this. 10 lots with stop loss and no take profit.
Now when the order gets in (creates a position) I want to have 5 partial take profits each with 2 lots. I've read on the manuals that you can do this by informing the position ticket on the request. So now I'm doing this:
But I'm getting error 10013 with the message
2019.01.10 21:50:11.251 2018.09.03 09:45:40 CTrade::OrderSend: exchange sell limit 2.00 position #2 WIN$N [invalid request].
Can someone help me please?