Trailing equity and closing all orders including oending orders

 

Hello, 

 I am using a hedging kind of "moderate" martingale strategy and what I need is: to stop trail overall equity and when it takes profit, to close all orders, including pending orders.

So far I only found the EAs that trail and close OPEN orders once trailing stop is hit, but they leave PENDING orders untouched, which is extremely dangerous, because if I am away from my computer they might get triggered with some disastrous consequences.

Could you please advice me some EA or if there is none could you code one?

 Thank you