Using if function for different takeprofits

 
Hi,
If I would like the takeprofit to change depending on a different condition would i be able to insert an if function into the takeprofit part of the OrderSend()?
Thanks,
Gee
 
TakeProfit will close order. You can't define TakeProfit to close part of order.
But you may set pending orders, which will be equal to partial TakeProfit, in opposite direction. Then use CloseBy window to close hedged orders.
 
Would anyone be able to give me an example code for pending orders and using the CloseBy? I am new to coding and I would really appreciate it.

Gee
Reason: