I think scripts and EAs can only be invoked manually by attaching them to the charts. Therefore, you cannot call a script from an EA's code, but you can call custom indicators.
One approach to use closealllosses.mq4 is to insert it as a function of you EA:-
1. open script code
2. rename its sart() function to start_close_all_losses()
3. copy and past the script code inside your EA
4. In the EA's logic where you detect that orders must be closed, call function start_close_all_losses()
Inside mql4 framework you can create libraries of functions that can be shared by distinct EAs, e.g if function start_close_all_losses(), and any function you want, is defined inside a library, it can be invoked by any EA

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
for example:
We have CloseAllLosses.mq4 script located in C:\Program Files\FXClearing\experts\scripts
On the other hand we have started Expert Advisor on EURUSD pair 30 min chart...
When the Loss is grater than 50 pips then I would like to close opened orders.
How can I refference to the CloseAllLosses.mq4 script in MQL CODE ?