NewFree guide: The EA Reality Check
BytePip
Auto Close Trades by Time and Magic Number for MT5

Close the trades of each EA at the time you set

It closes the open positions, in profit or in loss, and the pending orders of the magic numbers you choose at the times you set. One line per close, for example 05:00=105. It opens no trades: put it on any spare chart and it watches the whole account, next to your Expert Advisors, your trade copier or your manual trading.

By time, day and magicPositions and pending ordersRetries until doneOpens no trades
Auto Close Trades by Time and Magic Number with its close lines on the chart

Write the times, separated by semicolons

  • 05:00=105: at 05:00 it closes everything with magic number 105
  • 14:30=106,107: several magic numbers in one line
  • Fri 21:50=*: every trade of the account, on Fridays only, before the weekend
  • Mon-Thu 23:00=0: magic number 0 = the trades you opened by hand

24 lines can close 24 copies of an EA, each one at the end of its own hour. Long lists go on in the extra close time boxes.

One EA per hour, each one closed at the end of its hour

Every close written in the Experts tab

  • Retries: if the broker rejects a close, it tries again until nothing is left, for up to 60 minutes
  • A log line per close with the ticket, symbol, lots, magic number and profit
  • Terminal off at the time? The close still runs when it comes back within the minutes you set; later than that it is skipped, so nothing is closed hours later by surprise
  • The schedule on the chart: each line, its next run and what it would close right now, with a warning if Algo Trading is off
Every close written in the MetaTrader Experts tab

When you need it

Session EAs

An EA that trades one session and has to be flat when the session ends.

One EA, many charts

The same EA on several charts, each copy with its own magic number and its own closing time.

Before the weekend

Flat before the weekend, before the daily rollover or before the market closes.

Pending orders

Orders that must not stay alive after a certain time, deleted at that time.

Questions before buying

Does it open trades?

No. Only in the Strategy Tester, as a demonstration, because the tester runs one Expert Advisor at a time and has no other trades to close.

Which time does it use?

The broker's server time by default, the same time you see on the chart and in Market Watch. You can switch to the computer's clock.

Does it close trades opened by hand?

Yes, with magic number 0, or every trade with *.

What happens when the clocks change?

The server time of many brokers moves one hour with daylight saving time. If your close times are tied to a session, check them after the change.

Can two EAs on the same symbol close at different times?

On a hedging account, yes. On a netting account there is one position per symbol, so two EAs on the same symbol share it.

Every EA flat at its own time

Sold through the official MQL5 Market, 5 activations per purchase.

The EA Reality Check, free guide

Know if an EA works before you risk real money

The EA Reality Check, a free guide: the 12 tests I run on every strategy before it goes near a live account, with a one-page score sheet. Free PDF.

Where are you right now?