Server pluginRisk managementv1.1.012 options Live demo

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.

Get a licenseDownload

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.

15 of 15
ParameterTypeDefaultDescription
groups
group mask*Client groups that are handled (MT5 group mask). * means all
close_time
text22:00Server time of the day, HH:MM, when the plugin acts
weekdays
textmon,tue,wed,thu,friDays of the week when the plugin acts, for example mon,tue,wed,thu,fri
min_margin_level
number100.00Accounts with a margin level below this percent are handled
mode
textcloseclose: 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
int60Maximum minutes past close_time to still execute after a restart or delay; 0 means no limit
unconditional_close
bool01: handle all matching positions at close_time regardless of margin level
include_credit
bool11: include credit in equity when checking min_margin_level; 0: use own funds (equity minus credit)
warn_minutes_before
int0Minutes before close_time to send a pre-close warning mail to at-risk accounts. 0: off
notify_client
bool11: send MT5 mail to clients when positions are handled or warned before close
cancel_pending_orders
bool11: cancel matching pending orders on handled accounts at close_time
license_key
System
textemptyLicense key from FXOpsPro, for example FXO-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
license_server
System
texthttps://plugins.fxopspro.comLicense server address
dealer_login
System
int0Manager login with dealer rights that closes or opens positions for the plugin. 0: the plugin only logs

Release history

  1. 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

View all server plugins