thats the function -
https://docs.mql4.com/trading/ordercloseby
bool OrderCloseBy(
int ticket, // ticket to close
int opposite, // opposite ticket
color arrow_color // color
);
and you could apply it something like this
if(AccountEquity()-AccountBalance()>USDProfitTarget)
{
OrderCloseBy(order_id,opposite_id);
return(0);
}
https://docs.mql4.com/trading/ordercloseby
bool OrderCloseBy(
int ticket, // ticket to close
int opposite, // opposite ticket
color arrow_color // color
);
and you could apply it something like this
if(AccountEquity()-AccountBalance()>USDProfitTarget)
{
OrderCloseBy(order_id,opposite_id);
return(0);
}
1