Market On Close
Before the market closes, closes or net-locks the positions of accounts that are short of margin (or unconditionally), so they do not carry weekend or overnight gap risk.
What it does
6 capabilities- Runs once a day at a server time and weekdays you choose, with stale-window guard
- Handles accounts below min_margin_level (with or without credit) or unconditionally
- Close mode closes positions; lock mode hedges net volume per symbol
- Netting accounts safely fall back to close instead of attempting hedge-lock
- Cancels pending orders, sends pre-close warnings and client mail notifications
- Wildcard symbol list, MT5 group mask, persisted state, and full report
How it works
Once a day, at the close time you set and on the weekdays you choose, the plugin inspects accounts with open positions in matching symbols and groups. Accounts whose margin level is below min_margin_level (with or without bonus credit, via include_credit) — or all matching accounts when unconditional_close is enabled — are handled in close mode (closing positions) or lock mode (opening a single net opposite position per unhedged symbol, avoiding over-hedging; netting accounts fall back safely to close mode). Pending orders can be cancelled automatically (cancel_pending_orders), clients can receive pre-close warnings (warn_minutes_before) and execution notices (notify_client), and max_delay_minutes prevents stale late execution after a restart hours past close_time. State is persisted immediately via mark_dirty and every handled account is written to a report.
Parameters & options
Configured directly in MetaTrader 5 Administrator and testable live in the simulator.
| Parameter | Type | Default | Description |
|---|---|---|---|
groups | group mask | * | Client groups that are handled (MT5 group mask). * means all |
close_time | text | 22:00 | Server time of the day, HH:MM, when the plugin acts |
weekdays | text | mon,tue,wed,thu,fri | Days of the week when the plugin acts, for example mon,tue,wed,thu,fri |
min_margin_level | number | 100.00 | Accounts with a margin level below this percent are handled |
mode | text | close | close: close the positions. lock: open a single net opposite position per unhedged symbol (closes on netting accounts) |
symbols | text | * | Symbols that are handled, separated by commas (must not be empty; * means all). A name may end with * |
max_delay_minutes | int | 60 | Maximum minutes past close_time to still execute after a restart or delay; 0 means no limit |
unconditional_close | bool | 0 | 1: handle all matching positions at close_time regardless of margin level |
include_credit | bool | 1 | 1: include credit in equity when checking min_margin_level; 0: use own funds (equity minus credit) |
warn_minutes_before | int | 0 | Minutes before close_time to send a pre-close warning mail to at-risk accounts. 0: off |
notify_client | bool | 1 | 1: send MT5 mail to clients when positions are handled or warned before close |
cancel_pending_orders | bool | 1 | 1: cancel matching pending orders on handled accounts at close_time |
license_key | text | empty | License key from FXOpsPro, for example FXO-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX |
license_server | text | https://plugins.fxopspro.com | License server address |
dealer_login | int | 0 | Manager login with dealer rights that closes or opens positions for the plugin. 0: the plugin only logs |
Release history
- v1.1.0Latest2026-11-24
Fixed lock mode to hedge net volume per symbol instead of over-hedging individual tickets, with safe close fallback on netting accounts; fixed mark_dirty persistence; rejected empty symbols; cached symbol matching per run; added max_delay_minutes, unconditional_close, include_credit, warn_minutes_before, notify_client, and cancel_pending_orders.
Risk management



