How to Automate Closing All Trades at a Scheduled Time

If you’re an experienced trader who uses the popular MetaTrader platform, you may know that closing all trades manually can be a tedious and time-consuming task. However, with a little bit of coding knowledge, you can automate this process by writing a simple expert advisor to close all your trades at a scheduled time.

There are 2 videos showing how to write an expert that will close all trades at a scheduled time:
MT4 Video
MT5 Video

The videos take you through the steps to:

Create a new expert advisor (EA).

Write the code to close all trades and pending orders.

Write code to run the CloseAll function at the scheduled time

Additional code to run the schedule only on a selected day each week

Closing all trades at a scheduled time can save you time and ensure that you don’t miss any important market movements. By following these steps, you can write your own code to automate this process in MetaTrader.

Looking for a broker? Support the channel by using one of these links:
Good product range – IC Markets
High leverage for Australian customers – BlackBull Markets
Discount on commission – OX Securities

Download the code here.


Scroll to Top