Script or Expert to disable Autotradning and close all open trades MT4

 

Hi, MT4 question.

I wonder if somone has a script or EA that can be set on the terminal to watch the "My funds/credit", and if the funds will get smaller than for example 1000 USD It should disable autotrading, and then closes all open trades.

 
If EA disable autotrading, than EA couldn't open/close any trade. Effective solution is to remove from charts all other EA's and than close all trades and eventually disable autotrading.
 
I think it can be programmed, by removing the trading EA in this script/EA using ExpertRemove() or using unload and/or load a tempate that contains the EA..