@l-andorrà I said 1 trade and 19 pending orders. And yes I'm ready to close it all just because their sum is below 30... Here's the reason.
I'm using a trailing stop for group of orders. When the trailing stop is activated, everything is supposed to be deleted as I'm also using the check stop loss then delete order and close losable trades blocks. However, sometimes slippage or because the trades hit stop loss as soon as it is modified cause for only the modified orders to close and the pending orders just stay there while losable trades stay open and continue to run in loss.
So I need a way to close them all if they are less than a certain number. That way the ea keep searching to see if they are less than a certain number and close all