Real Margin Stopout
Closes the positions of a client whose own money is gone, so nobody keeps trading on credit alone.
What it does
7 capabilities- Exact 128-bit stop out on own funds: equity minus credit, divided by margin
- Fixed stop_level or per-group stop out threshold (use_group_stop_out)
- Close all positions or close largest-loss position one by one
- Optional filter to act only on accounts carrying bonus credit
- Cancels pending orders before liquidation and retries failed closes
- Optional credit removal once flat, persisted safely across restarts
- Optional client mail, risk team alert, and stopouts report
How it works
Credit and bonus lift the equity and margin level of an account, so the native MT5 stop out fires late. This plugin checks the client's own funds (equity minus positive credit) against margin using exact 128-bit arithmetic. When the own-funds margin level falls to or below stop_level (or the group's stop out level when use_group_stop_out is enabled), it cancels pending orders if configured and closes either all positions or the single largest-loss position until the account recovers or is flat. Tagged close actions with timeout retries prevent deadlocks on transient errors. Once flat, it can remove the bonus credit, notify the client by MT5 mail, alert the risk team, and write every stop out to a report. Use StopOut Notifier with exclude_credit=1 to warn clients before liquidation.
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 watched (MT5 group mask). * means all |
stop_level | number | 50.00 | Own-funds margin level in percent at or below which positions are closed |
remove_credit | bool | 0 | 1: remove the credit after the positions are closed |
only_with_credit | bool | 0 | 1: only act on accounts that currently have positive credit |
use_group_stop_out | bool | 0 | 1: use the account group's stop out level (when above 0) instead of stop_level |
close_mode | text | all | How to liquidate on stop out: all (close all positions) or largest_loss (close the worst losing position first) |
cancel_pending_orders | bool | 1 | 1: cancel pending orders on the account when triggering stop out |
notify_client | bool | 1 | 1: send an MT5 mail message to the client when stop out triggers |
notify_risk | bool | 1 | 1: raise a risk alert when stop out triggers |
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.2.0Latest2026-11-24
Fixed exact 128-bit margin comparison, negative credit clamping, mark_dirty persistence, and tagged close retries with timeout pruning. Added only_with_credit, use_group_stop_out, close_mode (all/largest_loss), cancel_pending_orders, notify_client, and notify_risk.
- v1.1.02026-11-22
Removed the warn_level parameter and the warning message. The StopOut Notifier plugin sends warnings now. The stop out and remove_credit do not change.
Risk management



