> For the complete documentation index, see [llms.txt](https://docs.metacopier.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metacopier.io/features/basic-features/scheduled-close-reopen.md).

# Scheduled close & reopen

The **Scheduled close & reopen** feature closes the open positions of an account at defined times and, if you want, opens them again later. Typical use cases are closing everything before the weekend and reopening on Monday, closing overnight to avoid swap and gap risk, or flattening the account before a daily broker rollover.

You can define **several schedules**, each with its own close time, its own optional reopen time and its own active weekdays. Every schedule can also be configured **per symbol**, so you can, for example, close gold every evening while leaving the FX positions untouched.

All times are interpreted in **UTC**.

## How It Works

1. At the **close time** of an active schedule, MetaCopier closes the open positions of the account (optionally including pending orders) and remembers what was closed: symbol, direction, volume, stop loss, take profit and close price.
2. If a **reopen time** is configured, the schedule stays armed until then and the positions are opened again with the stored volume and direction. With **Restore stop loss and take profit** the original SL/TP are applied again.
3. If **no reopen time** is configured, the positions are only closed, and new trades are blocked for a short grace period so the copier does not immediately reopen what was just closed.
4. The state is persisted, so a restart of the node does not lose the armed reopens. If the node was offline over the close time, the close is caught up as soon as it is online again while the schedule is still running.
5. Armed reopens expire after **24 hours**. If the reopen could not be executed within that window, the entry is discarded.

## Settings

* **Enabled:** Master switch. If it is off, no schedule is evaluated, not even the ones defined per symbol, and pending reopens are discarded.
* **Schedules:** The list of close and reopen definitions. Each entry has:
  * **Enabled:** Turns this single schedule off without deleting it.
  * **Label:** A free text name, for example `Weekend` or `Overnight`. It is only used for display and in the logs.
  * **Close time (UTC):** The time of day at which the open positions are closed.
  * **Reopen:** If disabled, the positions are only closed and never opened again by this schedule.
  * **Reopen time (UTC):** The time of day at which the closed positions are opened again.
  * **Reopen day offset:** How many days after the close day the reopen happens, `0` to `7`. Use `0` for an overnight schedule (close 21:00, reopen 07:00 the next morning is detected automatically) and `2` for a Friday close with a Sunday reopen.
  * **Active days:** The weekdays on which the close is executed. Leave the selection empty to run the schedule every day.
  * **Skip new trades until reopen:** While the schedule is running, the copier does not open new positions on the affected symbols. Without it the copier would immediately copy a new master trade into the window you just closed.
* **Include pending orders:** Pending orders are deleted at the close time and placed again at the reopen time with the same price.
* **Restore stop loss and take profit:** The stop loss and take profit of the closed position are applied again on the reopened one.
* **Only close positions in profit:** Only positions whose result including swap and commission is above zero are closed. Losing positions stay open.
* **Only close positions with negative swap:** Only positions that actually cost swap are closed, positions that earn swap stay open. This is the usual setting for an overnight schedule.
* **Max loss to close (points):** A position that is further than this many points in loss is left open instead of being closed at a bad price. `0` disables the check.
* **Max reopen slippage (points):** If the price moved further than this from the close price, the position is not opened again. This protects you from reopening into a large weekend gap. `0` disables the check.
* **Skip reopen if the master closed:** For copied positions, if the master closed its position in the meantime, the position is not reopened. This only applies to positions that came from a copier.
* **Add symbol configuration:** Define a completely separate configuration for a single symbol.

## Symbol configurations

A symbol entry **replaces the whole configuration** for that symbol, it is not merged field by field with the global one. Everything a symbol entry needs, including its own schedules and its own close and reopen options, has to be set inside that entry.

If you want the feature to be active **only for specific symbols**, leave the global **Schedules** list **empty** and add the symbols you want below. All other symbols then have no schedule and are never touched.

{% hint style="info" %}
Do not use **Enabled** to achieve "only for one symbol". **Enabled** is a master switch and an emergency stop: switching it off also discards the reopens that are already armed. Use an empty global schedule list instead.
{% endhint %}

{% hint style="info" %}
All times are **UTC**, not broker time and not your local time. If your broker server runs on GMT+3, a broker-time close at 23:00 corresponds to 20:00 UTC.
{% endhint %}

{% hint style="warning" %}
Reopening a position always happens at the current market price. Volume, direction and, if enabled, stop loss and take profit are restored, but the entry price will differ from the original one. Use **Max reopen slippage (points)** to limit how far the price may have moved before the reopen is skipped.
{% endhint %}
