Hi,
closing all trades is quite simple.
e.g. omething like this, but of course a little bit more complex according to your triggers
if (your trigger is true)
{
for(cnt = 0; cnt < total; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 0);
}
}
You can try to develop this on your own, or if you want my help, do not hesitate to get in touch.
Best regards
von Oak