Server pluginBonus and promotionsv1.3.020 options Live demo

Deposit Bonus Risk Manager

Pay deposit bonuses as credit with configurable withdrawal, expiry, lot-to-balance conversion, and margin protection rules.

Get a licenseDownload

What it does

10 capabilities
  • Multiple CRM-managed campaigns with different MT5 groups, bonus %, min deposit, bonus cap, credit use, min hold, and max validity
  • Signed live config sync from the CRM over crm_webhook_url/config with local disk fallback
  • Bonus percentage (up to 500% without self-destruct), min deposit, per-deposit and lifetime caps
  • Three withdrawal policies: remove on principal, remove all, or proportional
  • Three expiry modes: first deposit, rolling, or per tranche, with optional close on expiry
  • Auto-convert bonus credit to withdrawable real balance per lot traded
  • Closes positions and removes credit when own funds are used up
  • Optional negative-balance offset and automatic principal reset when flat at zero
  • Skips wallet transfers and cashback/rebate/bonus comment prefixes to stop bonus loops
  • Signed CRM webhooks with strict HTTPS/SSRF URL validation and offline license cache

How it works

Grants a bonus as credit on each qualifying deposit with configurable percentage (including >100% promotions), minimum deposit, per-deposit cap, lifetime cap, and validity mode (first deposit, rolling, or per tranche). Protects the broker by closing positions and removing bonus credit when own funds are exhausted and margin or credit-use limits trigger, with configurable low-balance removal and optional negative-balance offset when flat. Supports three withdrawal policies (remove on principal, remove all, or proportional), resets tracked principal cleanly after flat zero-balance resets, optionally converts bonus credit into withdrawable balance per lot traded, and skips wallet transfers plus cashback/rebate/bonus comment prefixes to prevent bonus loops. Sends MT5 expiry reminders and HMAC-SHA256 signed CRM webhooks. Use Bonus Abuse Protector for scalping/short trades and Hedge Guard for opposite-side hedging.

Parameters & options

Configured directly in MetaTrader 5 Administrator and testable live in the simulator.

23 of 23
ParameterTypeDefaultDescription
bonus_percent
number30.00Bonus, percentage of the deposit
bonus_cap
number5000.00Maximum credit amount in the life of an account
min_deposit
number0.00Minimum deposit amount to qualify for a bonus (0.00 = no minimum)
max_bonus_per_deposit
number0.00Maximum bonus credit granted on a single deposit (0.00 = no per-deposit cap)
credit_use
number100.00Credit use limit, percentage of the credit
min_hold
int0Minimum trade hold time in seconds before a short-trade alert fires on a bonus account (0 = off)
remove_on_low_balance
bool11: remove bonus when balance falls below the low-balance threshold. 0: off
withdrawal_rule
textremove_on_principalWithdrawal policy: remove_on_principal, remove_all, or proportional
reset_principal_on_zero
bool11: reset tracked principal to 0 when balance <= 0 and flat. 0: keep
max_validity
int30Bonus validity, in days
expiry_mode
textfirst_depositExpiry tracking mode: first_deposit, rolling, or per_tranche
close_on_expiry
bool01: close open positions before removing expired bonus credit. 0: off
expiry_notice
text7,3,1Days before expiry when the client gets a reminder by MT5 mail, comma separated. 0 means none
lot_conversion_ratio
number0.00Bonus credit converted to withdrawable real balance per 1.00 lot traded (0.00 = off)
negative_balance_reset
bool01: offset negative balance cleanly from remaining credit when flat. 0: off
groups
group mask*Client groups that can get a bonus (MT5 group mask, for example real\*,!real\vip). * means all
no_bonus_comments
textwallet transferText in the deposit comment that marks a transfer from the client's wallet: no bonus. Comma separated, not case sensitive. none turns it off
exclude_comment_prefixes
textCashback,Bonus,Rebate,PromoDeposit comment prefixes skipped to prevent bonus loops (comma separated, case-insensitive). none or empty turns it off
crm_webhook_url
textemptyHTTPS address of the CRM webhook. Empty: no webhook
crm_webhook_key
textemptySecret key (16 characters or more) that signs each webhook request (X-FXO-Signature, HMAC-SHA256). The same key goes in the CRM
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 that closes positions for the plugin. 0 means the plugin only removes credit and does not close positions

Release history

  1. v1.3.0Latest2026-12-01

    Added CRM-managed multi-campaign support (per-MT5-group bonus_percent, min_deposit, bonus_cap, credit_use, min_hold, max_validity, and advanced rules) synced over signed GET <crm_webhook_url>/config with local cached fallback, short-trade min_hold alerts on bonus accounts, and campaign_id/campaign_name reporting on webhooks.

  2. v1.2.02026-11-24

    Fixed >100% bonus self-destruct on grant, negative format_hundredths, webhook URL SSRF/userinfo bypass, MT5 Start() exception safety, IMTMail RAII leak, WinHTTP shutdown hang, and O(N^2) 2s snapshot copy. Added .license disk cache (72h grace, 600s skew check), dirty-flag saving, remove_on_low_balance, min_deposit, max_bonus_per_deposit, withdrawal_rule, reset_principal_on_zero, expiry_mode, close_on_expiry, lot_conversion_ratio, negative_balance_reset, and exclude_comment_prefixes.

  3. v1.1.02026-11-22

    Each plugin does its own job: the short trade alert (min_hold) and the opposite trade alert on linked accounts were removed. The plugin no longer subscribes to positions. Old saved state still loads.

CRM webhook

CRM webhook

The plugin sends each bonus event to your CRM as a signed HTTPS POST with a JSON body. Use it to show the client the bonus and a countdown to its expiry, and to keep the CRM in step with MT5.

Set up

  1. Set crm_webhook_url to the HTTPS address of your CRM endpoint.
  2. Set crm_webhook_key to a random secret of 16 characters or more. Keep the same key in the CRM. The key is never sent: it only signs each request.
  3. The plugin sends webhook.test at start and when the address or key changes. Answer it with HTTP 200 to confirm the setup.
  4. The CRM writes the comment "Wallet transfer #<id>" on each deposit that comes from the client's wallet. The plugin gives no bonus on it (parameter no_bonus_comments, default "wallet transfer").

Request

POST · application/json

X-FXO-Eventbonus.grantedThe event type, the same as type in the body.
X-FXO-Deliveryevt_9f2c4e7a1b3d5f60a8c2e4b6The event id, the same as id in the body. A retry has the same id: use it to skip duplicates.
X-FXO-Timestamp1794565200Unix time (seconds, UTC) of this attempt.
X-FXO-Signaturesha256=6f1d...c09aHMAC-SHA256 of timestamp + "." + raw body, with crm_webhook_key, as hex.

Signature

  1. Read the raw request body as bytes, before any JSON parsing.
  2. Compute HMAC-SHA256 with your key over: X-FXO-Timestamp, a dot, the raw body.
  3. Compare "sha256=" + hex result with X-FXO-Signature (constant-time compare).
  4. Reject the request if the timestamp is more than 300 seconds from your clock.
// Node.js (Express): app.post('/hooks/fxo', express.raw({ type: 'application/json' }), handler)
const crypto = require('crypto');
function verify(req, key) {
  const ts = req.get('X-FXO-Timestamp');
  const sig = req.get('X-FXO-Signature') || '';
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const mac = 'sha256=' + crypto.createHmac('sha256', key).update(ts + '.').update(req.body).digest('hex');
  return sig.length === mac.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(mac));
}

Delivery

  • Answer with any 2xx status to confirm. Other answers and network errors are retried after 10 seconds, 1, 5 and 15 minutes.
  • After the last retry the request is written to <plugin name>.webhook-failed.jsonl in the MT5 plugin folder, for a manual resend.
  • Events can arrive more than once and, after a retry, out of order. Use id to skip duplicates and created_at to order them.
  • Money is a string with 2 decimals in the account currency ("150.00"). Times are UTC, ISO 8601.

Envelope

{
  "created_at": "2026-11-13T10:00:00Z",
  "data": {},
  "id": "evt_9f2c4e7a1b3d5f60a8c2e4b6",
  "plugin": "deposit-bonus",
  "plugin_version": "1.0.6",
  "server": "Broker-Live #1",
  "type": "bonus.granted"
}

Events

bonus.granted A deposit got a bonus. One event for each deposit. Start or update the countdown with expires_at.

{
  "amount": "40.00",
  "bonus_cap_left": "440.00",
  "bonus_given": "60.00",
  "bonus_percent": "20.00",
  "credit": "60.00",
  "credited_at": "2026-11-10T10:00:00Z",
  "currency": "USD",
  "days_left": 27,
  "deposit": "200.00",
  "expires_at": "2026-12-10T10:00:00Z",
  "login": 50123,
  "seconds_left": 2332800
}
amount
Bonus of this deposit.
bonus_cap_left
Bonus the account can still get.
bonus_given
Bonus given in the life of the account (the cap counts this).
credit
All bonus credit on the account now.
expires_at
When the bonus is removed. A later deposit does not move it.

bonus.removed Bonus credit was taken off the account. Stop the countdown when credit is "0.00".

{
  "amount": "100.00",
  "credit": "0.00",
  "currency": "USD",
  "login": 50123,
  "reason": "withdrawal_above_profit"
}
reason
withdrawal_above_profit (the client took deposited money, not only profit), expired, balance_below_credit, margin_level_limit, credit_use_limit (own funds used up: positions closed), zero_balance (balance 0 or less after the last close: all credit removed)

bonus.expiry_reminder Days left reached a value of expiry_notice (default 7, 3, 1). The client also gets the message as MT5 mail.

{
  "credit": "60.00",
  "currency": "USD",
  "days_left": 7,
  "expires_at": "2026-12-10T10:00:00Z",
  "login": 50123,
  "message": "Your bonus credit of 60.00 expires in 7 days, on 2026-12-10 12:00 server time. After that time it is removed from the account.",
  "seconds_left": 604800
}

bonus.status Each hour: every account with bonus credit, 500 accounts in each request. Use it to correct the CRM if an event was lost.

{
  "accounts": [
    {
      "bonus_given": "60.00",
      "credit": "60.00",
      "credited_at": "2026-11-10T10:00:00Z",
      "currency": "USD",
      "days_left": 27,
      "expires_at": "2026-12-10T10:00:00Z",
      "login": 50123,
      "seconds_left": 2329200
    }
  ],
  "part": 1,
  "parts": 1
}

deposit.no_bonus A deposit got no bonus because its comment marks a transfer from the client's wallet.

{
  "amount": "300.00",
  "comment": "Wallet transfer #88412",
  "currency": "USD",
  "login": 50123,
  "reason": "wallet_transfer"
}

webhook.test The plugin started, or the address or key changed.

{
  "message": "The Deposit Bonus plugin is connected to this webhook."
}

Bonus and promotions

View all server plugins