Closing an open position with a limit order

 

Hi guys,

If I have an open position with its TP and SL settled with OrderModify(), is it possible to close this position with a new limit order (like a new different TP) and so having at the same time two TP for the same order?

I think that if I have a buy order at market and then send a sell limit order with OrderSend() at the end I'd have two opposite orders and not the closing of the buy position with the sell limit. Isn't it?

Thanks a lot guy.

 
MakMax :


Hi guys,

If I have an open position with its TP and SL settled with OrderModify(), is it possible to close this position with a new limit order (like a new different TP) and so having at the same time two TP for the same order?

I think that if I have a buy order at market and then send a sell limit order with OrderSend() at the end I'd have two opposite orders and not the closing of the buy position with the sell limit. Isn't it?

Thanks a lot guy.


not with a limit order that has to become first a market trade

for sell and buy trades open and close read OrderCloseBy

 
You don't open opposing trades with mq4. You close the trade instead. If you want two TPs you can either A) open two orders or B) do a partial close of the existing. See my code
 

I was hoping there was a way of closing a trade using a limit order...Thanks guys!