Close All Trades Script

 

Is there a way to create (unless one already exists) a script that can be run to close all open trades of all currencies? When one is testing an EA over multiple pairs (the ability to open trades), one needs to "reset" so that there aren't open trades. Is there a way to create a script that can do this.

Thanx

 
gkozlyk:
Is there a way to create (unless one already exists) a script that can be run to close all open trades of all currencies? When one is testing an EA over multiple pairs (the ability to open trades), one needs to "reset" so that there aren't open trades. Is there a way to create a script that can do this. Thanx

There is some thread here https://www.mql5.com/en/forum/173000

But seems these scripts do not work for some people. It works for me and I really don't understand why.

 
newdigital:
There is some thread here https://www.mql5.com/en/forum/173000 But seems these scripts do not work for some people. It works for me and I really don't understand why.

Very helpful. Thanks

 

"CloseOnTime" SCRIPT?

Attached is the "CloseOnTime" EA.

I'd like to attach this to one open trade only.

Can someone please convert this to a script for just one position?

Thanks.

Files:
 

This shoul do the trick just enter the order number in the external variable Order_Ticket

Files:
 

The other EAs from the same author (KimIV):

- EA to close all the orders by percent of the profuit and close Metatrader after that automatically.

- Open on time. EA can opne the order at selected time:

TimeTrade="19:51" - time to open the order

Sell=False - True - Sell, False - Buy

MagicNumber (it has magic number option)

NumberAccount=0 (0 - any account)

 
faqcya:
This shoul do the trick just enter the order number in the external variable Order_Ticket

Excellent! Thanks very much.

Reason: