AMF Guaranteed Stop for MT5
AMF Guaranteed Stop for MT5 is a 64-bit server plugin for MetaTrader 5 (file CPlugin.AMF.dll). It makes your trading server insist on a protective Stop Loss on every trade and reserves enough margin to cover the loss that the Stop Loss allows. It is built for brokers who work under AMF (France) rules and need to limit the risk a client can take.
This page describes version 2.00 (MT5 Administrator shows it as 200). The MetaTrader 4 edition has its own guide: AMF Guaranteed Stop for MT4. An overview of both is on AMF Guaranteed Stop.
Contents
- Who it is for
- What the plugin does
- What the plugin does not do
- Units: points, not pips
- Requirements
- Installation
- Upgrading from version 1.22
- Settings reference
- Rule line format
- Masks
- Which line is used for a trade
- How the rules work in detail
- Examples
- Licence and free trial
- What the plugin sends
- When a trial or a licence ends
- Troubleshooting
- FAQ
- Limitations and differences from the MT4 edition
- Changelog: version 2.00
- Getting the plugin
Who it is for
Brokers and white-label operators who run their own MetaTrader 5 server and want every client trade to carry a Stop Loss within limits they define, with the margin of the trade covering the worst-case loss. It works with hedging and netting accounts. Typical use: retail accounts of a broker that must limit client losses, with an optional fee for the guaranteed execution of the stop.
What the plugin does
For every account and symbol covered by your rules, the plugin does five things:
| # | Rule | What it means |
|---|---|---|
| 1 | Requires a Stop Loss | A request without a Stop Loss is rejected. |
| 2 | Limits where the Stop Loss may be | The distance between the price and the Stop Loss must be at least your minimum and at most your maximum (both in points). |
| 3 | Never lets the client increase the potential loss | The client may move the Stop Loss closer to the price (smaller loss). Moving it away, or removing it, is rejected. Changing only the Take Profit is always allowed. |
| 4 | Reserves margin for the worst case | The margin of a trade is the larger of (a) the normal margin of the trade and (b) the maximum loss at the Stop Loss level. A trade is rejected with No money if the free margin of the account does not cover that amount. |
| 5 | Charges an optional premium | An extra commission, per lot, when a Stop Loss is triggered. It appears on the client's account as a separate commission deal. |
Two further optional features: a limit on the volume (in lots) a client can hold on one symbol, and a ban on Buy Stop and Sell Stop pending orders for chosen account groups.
What the plugin does not do
- It does not change the price or the way the server executes a stop order. Execution stays entirely with the MT5 server.
- It never blocks closing a position, never closes a position by itself, and never changes a client's balance except for the premium described above.
- It does not touch accounts and symbols that no rule line covers.
- It does not remove a Stop Loss that a client has already set.
- When it is not sure, it does nothing. If a price is missing, the server cannot answer a question the plugin needs (margin, the value of a point, the open positions), the settings are invalid, the plugin is switched off or there is no licence, the plugin does not intervene: the server handles the request exactly as if the plugin were not installed. It never rejects a request because of its own problem. The reason is written to the server journal.
Units: points, not pips
- Point means the smallest price step of the quote: one unit of its last digit. For a 5-digit quote such as EURUSD 1.10000, one point is 0.00001, so 1 pip = 10 points. For a 3-digit quote (USDJPY 150.000) one point is 0.001. For a 2-digit index quote (4500.25) one point is 0.01, even when the symbol moves in steps of 0.25. All distances in the settings are in points, not pips and not price steps.
- Lot means volume as shown in the trading terminal (1.00 lot, 0.10 lot).
Worked margin example. EURUSD (5 digits), buy at 1.10000 with Stop Loss 1.09500. The distance is 500 points (50 pips). With a contract of 100 000 units, 500 points is a loss of 500 USD per lot.
| Case | Normal margin for 1 lot | Loss at the Stop Loss | Margin the plugin requires |
|---|---|---|---|
| Leverage 1:500 | 220 USD | 500 USD | 500 USD (the loss is larger) |
| Leverage 1:100 | 1 100 USD | 500 USD | 1 100 USD (normal margin applies unchanged) |
Requirements
- MetaTrader 5 server (64-bit) with plugin support.
- The
pluginsfolder must be writable for the server process: the plugin keeps its licence file and two small files of its own there. - Outgoing internet access from the server to
update.cplugin.com, port 443 (HTTPS), for the free trial and for the automatic delivery and renewal of the licence. For a paid licence on a server without outgoing access, CPlugin support sends the licence file to install by hand.
Installation
- Get a licence first (see Licence and free trial): without a licence or a running trial the plugin does not intervene at all.
- Copy
CPlugin.AMF.dllinto thepluginsfolder of the MT5 server and add the plugin in the MT5 Administrator as usual. - Make sure the server can reach
update.cplugin.comon port 443. - When the plugin is added for the first time, MT5 fills in a set of example parameters with
Enable=0: the plugin loads them and does nothing. (If the configuration has no parameters at all, for example it was created without the Administrator, the plugin adds the missing example parameters itself, withEnable=0; it never changes a parameter you have set.) Replace the example rule lines with your own (format below), then setEnable=1. - Parameters changed in the Administrator are applied immediately, no restart is needed.
Files the plugin keeps next to the DLL: CPlugin.AMF.license (the licence), CPlugin.AMF.hub.key (the plugin's own key, see What the plugin sends) and CPlugin.AMF.hub.state (when it last contacted the update service). A copy of the DLL under another name is a separate installation with its own files and its own licence. One DLL file runs one plugin configuration; to run a second configuration on the same server, copy the DLL under another file name.
After the start, look at the server journal: the plugin prints its version and every parameter it has read (config: lines) and the line config: version N in force. Check that your rule lines are printed as you expect.
Upgrading from version 1.22
- A new licence is needed. Version 2.00 works only with the licence described in Licence and free trial, under its own product name AMF MT5. A licence file of version 1.22 (also a licence of the FlexibleLeverage plugin, which version 1.22 accepted) is not read. Until the new licence or a trial is in place the plugin does not intervene: orders are handled by the server as if the plugin were not installed.
- Already paying a subscription? Write to CPlugin support before or right after the upgrade: the subscription moves to the new licence and the paid period carries over. Do not buy again. You can keep using version 1.22 with your current licence for as long as you like.
- Your settings are kept. They live in the server's plugin configuration and are not replaced. Version 2.00 checks them more strictly, so check them before the upgrade (see the list below).
- Choose a quiet time. Replacing the DLL needs a restart of the MT5 trading server, not only of the plugin. Once started, the plugin keeps its DLL loaded until the server process ends; switching the plugin off and on in the Administrator keeps running the old DLL, and Windows refuses to overwrite the file while it is loaded. Check the version in the journal line "has been initialized (ver. ...)" after the restart. The plugin does not intervene until the licence is in place.
- Buying the licence: start the plugin, take the pairing code from the server journal, sign in to CPlugin Toolbox, open Billing, Licenses, enter the code and buy the licence. After the payment the licence reaches your server by itself at the plugin's next contact with the update service (at the start and then about once a day). The link to the page is written to the journal.
What to check in your settings before the upgrade:
| Area | What changed |
|---|---|
| Settings as a whole | A single broken line (for example the two example lines version 1.22 put in at installation, which had too few fields) now stops the whole new set from loading. At the server start this means the plugin does nothing until it is fixed. |
Enable=0 | Now really switches the plugin off. Version 1.22 applied the rules even with Enable=0. |
Reject Pending Stops | Now forbids Sell Stop as well as Buy Stop. |
Masks with ! | Now follow the MT5 rule: an exception always wins. |
maxP | Now counts the real volume of the positions and understands netting accounts. |
Settings reference
The plugin is configured through its parameters in the MT5 Administrator. Example:
Enable=1
Verbose=1
Reject Pending Stops=0
Reject Pending Stops - Groups=demo*,test*
Commission comment=AMF
Current Working Preset=0
Preset[0] Name=Basic
Preset[0][0]=EURUSD,GBPUSD;-1;demo*;10;500;100;3.5;USD
Preset[0][1]=-1;Forex\*;*;20;-1;-1;0
Preset[1] Name=NFP
Preset[1][0]=-1;Forex\*;*;100;1000;50;10;USD
| Parameter | Meaning | Default |
|---|---|---|
Enable | 1: the plugin works. 0: it does nothing at all (no check, no margin change, no premium, no comment). Only 0 or 1 is accepted. | 0 |
Verbose | How much the plugin writes to the server journal, 0 to 5. 1 is enough for daily work (settings, every rejection, every premium); 4 also shows why a request was not checked; 5 is the most detailed. | 1 |
Reject Pending Stops | 1: forbid Buy Stop and Sell Stop pending orders for the groups below. Only 0 or 1 is accepted. Stop-limit orders are not covered. | 0 |
Reject Pending Stops - Groups | Mask of account groups for which the ban applies (mask syntax). Works only when Reject Pending Stops=1. | demo* |
Commission comment | Text for the premium deal. The comment becomes <text> #<order ticket>, for example AMF #1234567; when the whole comment would be longer than 31 bytes, the text is shortened and #<ticket> is always kept. The text itself may be up to 31 bytes in UTF-8: 31 Latin letters or digits, but only 15 Cyrillic letters (each takes 2 bytes); a longer text is a settings error. Note the spelling: in MT5 this parameter is Commission comment with a small "c". | commission |
Current Working Preset | Number of the preset that is active, counting from 0. Only this preset is used. Switch it to change the whole set of rules at once (for example before a news release). | 0 |
Preset[i] Name | A human-readable name of preset i. Informational only. | none |
Preset[i][j] | Rule line number j of preset i (format below). Numbers start from 0 with no gaps. | none |
The settings are checked as a whole
Every parameter is checked every time the settings are loaded. If anything is wrong (a line with the wrong number of fields, a number that is not a number, a gap in the numbering, the same parameter twice, Current Working Preset pointing to a missing preset, an Enable value other than 0 or 1) nothing of the new settings is applied, and the journal lists every problem found, one line each:
- When you change the settings in the Administrator, the previous settings stay in force (
config: rejected (...); configuration version N stays in force). - When the server starts with invalid settings, the plugin does not intervene at all until the settings are corrected (
there is no valid configuration, the plugin does not intervene).
So the plugin never works with half of your rules. Warnings (for example a line that can never match anything, or an unknown parameter name) are written to the journal but do not stop loading.
Rule line format
Preset[i][j] = symbols;symbols groups;user groups;minSL;maxSL;maxP;commission per 1 Lot;currency
Seven or eight fields separated by ;. The last field (currency) may be omitted or left empty.
| Field | Meaning |
|---|---|
symbols | Which symbols the line applies to, as a mask over the symbol name (for example EUR*,*USD*). -1 means "do not select by symbol name". |
symbols groups | Which symbols the line applies to, as a mask over the symbol path (the Path field in the symbol settings, for example Forex\EURUSD or Forex\Majors\EURUSD). To select a whole folder write Forex\*. -1 means "do not select by path". |
user groups | Which account groups the line applies to, as a mask, for example demo*,real\std. It must match, or the line is skipped. |
minSL | Minimum distance from the price to the Stop Loss, in points. Fractions are allowed (10.5). |
maxSL | Maximum distance from the price to the Stop Loss, in points. -1 means no maximum. |
maxP | Maximum volume in lots that one account may hold on one symbol (see Maximum volume). -1 or 0 means no limit. |
commission per 1 Lot | Premium charged per lot when a Stop Loss is triggered, in the given currency. 0 means no premium. |
currency | Currency of the premium (USD, EUR), up to 11 letters or digits. If omitted, the account group's currency is used. |
minSL=0 or maxSL=0 checks nothing. Such a line is still chosen for its accounts and symbols (so it hides the lines after it), but it performs no Stop Loss, margin or volume check; the premium of such a line is still charged. Every time the settings are loaded the journal warns: line Preset[i][j] is inactive: minSL/maxSL is 0; use 1 for no minimum. If you do not want a real minimum, use 1.Negative values other than -1, a minSL larger than maxSL, and a maxP so small that it is less than 0.00000001 lot are errors.
Masks
A mask is a short pattern that says which names or groups a rule applies to. Masks work exactly as the masks in the MT5 group settings.
| Syntax | Meaning | Example |
|---|---|---|
* | Any number of any characters | EUR*, *USD*, * |
, | Separates several masks | EURUSD,GBPUSD,XAU* |
! in front of a mask | "Except", wherever it stands in the list | !vip*,* and *,!vip* both mean "everything except names starting with vip" |
Rules to remember:
- Upper and lower case are different:
Demo*does not matchdemo\usd. - Spaces at the end of a mask are ignored; spaces inside are part of the mask.
- One mask (between commas) may be up to 255 characters; tabs and other control characters are not allowed.
-1is not "everything". It means "this field is not used for choosing". To cover all symbols write*. If bothsymbolsandsymbols groupsare-1, the line can never match any symbol and does nothing (the journal warns about it).
Which line is used for a trade
- Only lines whose
user groupsmatch the account's group are considered. - Among them, the first line whose
symbolsmask matches the symbol name is used. - If no line matches by name, the first line whose
symbols groupsmask matches the symbol path is used. - If nothing matches, the plugin lets the trade through untouched.
So a line for a specific symbol always wins over a line for a whole folder, wherever the two lines stand in the list. Only the active preset (Current Working Preset) is looked at.
How the rules work in detail
The plugin looks at these requests: instant, market and exchange execution, placing a pending order, modifying an order or the Stop Loss / Take Profit of a position, activating a pending order, and the same actions done by a dealer, with the same rules.
Closing is never blocked. A request that closes or reduces a position is never checked: a close request, a close by an opposite position, Take Profit, stop out, an order that names the position it closes, and, on netting accounts, an opposite order that is not larger than the position. Only the part of an order that opens new exposure is checked: on a netting account with a buy of 0.5 lot, a sell of 0.7 lot is checked as a new sell of 0.2 lot (it needs a Stop Loss, and the margin is reserved for 0.2 lot). If the plugin cannot read the account's positions, it cannot tell a close from an open and does not intervene.
Opening an order
- No Stop Loss: rejected with Invalid stops (
TRADE_RETCODE_INVALID_STOPS, 10016). - Distance outside
minSLormaxSL: rejected with Invalid stops. For market orders the distance is counted from the current price on the closing side (bid for a buy, ask for a sell); for pending orders, from the order price. The distance is counted to 0.01 point: withminSL=50, a distance of 49.60 points is rejected. - Margin (market orders and activations): the plugin compares the normal margin of the trade (as the server calculates it) with the maximum loss at the Stop Loss: points from the open price to the Stop Loss on the losing side, times the value of one point for one lot, times lots, rounded to cents. A Stop Loss at or beyond the open price on the profit side allows no loss: it reserves nothing and the normal margin applies. The value of one point is the profit of a one-point move of one lot, in the account currency, as the server calculates it for the account's group. If the free margin of the account before the trade is lower than the larger of the two, the request is rejected with No money (10019). Otherwise the trade opens, and when the maximum loss is the larger amount, the margin of the new position is raised to it.
- A trade that does not add margin (it hedges or reduces an existing position) is not checked.
- The open price is the price the server prepared for the trade, otherwise the requested price, otherwise the current ask (buy) or bid (sell).
- A dealer request with the flag skip margin check is not checked for margin.
- Maximum volume
maxP: see below; rejected with Invalid volume (10014).
Modifying an order or a position
- Removing the Stop Loss is rejected.
- Moving the Stop Loss away from the price (lower for a buy, higher for a sell) is rejected.
- For a pending order, changing the order price and the Stop Loss together is allowed only when the potential loss (distance from the order price to the Stop Loss on the losing side) does not grow. Moving the order price away from its Stop Loss is rejected.
- On an open position the new Stop Loss must still be at least
minSLpoints from the market. The maximummaxSLis checked when the order is placed or opened, not when it is modified. - Adding a Stop Loss where there was none is allowed.
- Changing only the Take Profit is always allowed, and it does not touch the margin.
- After every fill of an order (a partly filled order is charged for the part already filled), when a netting position grows and when it is reversed, the server first sets the normal margin of the position. If the loss at the Stop Loss is larger, the plugin raises the margin of the position to that loss. It never lowers the margin the server has just set.
- After a Stop Loss change of a position the margin of the position is recalculated: the larger of the normal margin and the loss at the new Stop Loss. The plugin reads the margin the position really carries from the position itself, so a position opened before the plugin was switched on is handled correctly too. When the normal margin is the larger one, nothing changes. The margin of a position comes down (for example after the Stop Loss is moved closer to the price) only when the server can tell the plugin the normal margin of that position: the server answers the plugin's margin question, and the account has no position in the opposite direction on the same symbol. Otherwise the plugin keeps the higher margin and writes the reason to the journal.
Pending orders
- A pending order is accepted at placement when its Stop Loss follows the rules above.
- When the pending order is about to be activated, the plugin checks everything before it does anything:
- a forbidden Buy Stop or Sell Stop (see below) is not activated and stays pending;
- an order without a Stop Loss is not activated;
- if the margin is not enough, the pending order is removed with the comment
deleted [no money]; - if the volume limit would be exceeded, the order is not activated and stays pending;
- a pending order that only reduces or closes a netting position is never checked or removed, whatever its type; one that reverses the position is checked for the part that opens the new position. A partly filled order is checked for its remaining volume.
Maximum volume (maxP)
The limit applies per account and per symbol (the exact symbol name; EURUSD and EURUSD.m are different symbols). Pending orders are not counted.
- Hedging accounts: the sum of all open positions on the symbol, buy and sell added together, plus the new order, may not exceed
maxP. Example withmaxP=1: open buy 0.5 and sell 0.3; a new buy 0.2 is accepted (1.0), a new buy 0.3 is rejected (1.1). - Netting accounts: the one net position after the order may not exceed
maxP. Example withmaxP=4: net buy 5 (the limit was lowered later), a sell 1 is accepted (it reduces the position to 4); with net buy 2, a sell 7 is rejected (it would turn into sell 5), a sell 6 is accepted (sell 4). - An order that only reduces the position is always accepted, even above the limit. Nothing is ever closed by the plugin: a client above a lowered limit simply cannot add volume.
Premium on a triggered Stop Loss
When a position is closed by its Stop Loss and the matching rule has a non-zero commission per 1 Lot:
- The premium is the commission times the closed lots times the conversion rate from
currencyto the currency of the account group, rounded to cents once. The closed lots are those of the closing deal. - Before charging, the plugin checks that the free margin covers the whole premium. If not, or if the conversion rate cannot be obtained, nothing is charged and an error is written to the journal.
- The premium is deducted by a separate commission deal with the comment
<Commission comment> #<order ticket>. - It is charged once per closing deal, even if the server reports the same closure twice; a Stop Loss closed in several deals is charged for each deal's volume. If the server refuses the commission deal, or accepts it without a deal number, the plugin does not try again (it cannot know whether the money moved) and writes an error to the journal: check the account by hand.
The order and the deal closed by the Stop Loss get the comment [Guaranteed SL Triggered] when the account and symbol are covered by an active rule line (minSL and maxSL not 0). The comment says only that the Stop Loss closed the position under the plugin's rules. It does not say that a premium was charged: the premium is a separate commission deal with your Commission comment text. A Stop Loss closure can carry the comment without a premium (for example, premium 0 or not enough free margin), and a premium can be charged without the comment (a line with minSL=0 or maxSL=0 and a premium). Positions closed by Take Profit, by the client, or by stop out do not incur the premium.
Forbidding pending stops
With Reject Pending Stops=1, a Buy Stop or a Sell Stop from an account whose group matches Reject Pending Stops - Groups is rejected with Trade disabled (10017) when the order is placed, and an already existing one is not activated.
Examples
Demo accounts on two symbols. Accounts in groups starting with demo, on EURUSD and GBPUSD: Stop Loss between 10 and 500 points, no more than 100 lots per symbol, premium 3.5 USD per lot.
Preset[0][0]=EURUSD,GBPUSD;-1;demo*;10;500;100;3.5;USD
All other Forex symbols. All other symbols in the Forex folder, all account groups: Stop Loss at least 20 points from the price, no maximum, no volume limit, no premium.
Preset[0][1]=-1;Forex\*;*;20;-1;-1;0
Everyone except VIP. Every account group except those starting with vip, on all symbols of the CFD folder: Stop Loss from 50 to 2 000 points.
Preset[0][2]=-1;CFD\*;!vip*,*;50;2000;-1;0
A news preset. A second preset with tighter rules to switch on during news (set Current Working Preset=1 before the release and back to 0 after):
Preset[1] Name=NFP
Preset[1][0]=-1;Forex\*;*;100;1000;50;10;USD
Ban on Buy Stop and Sell Stop for demo and test accounts.
Reject Pending Stops=1
Reject Pending Stops - Groups=demo*,test*
Licence and free trial
To work, the plugin needs a licence for using it on your trading server. It is not a MetaTrader licence: your agreement with MetaQuotes is not affected. The licence is the file CPlugin.AMF.license next to the DLL, delivered and renewed automatically by the CPlugin update service (or installed by hand). A licence can be limited to certain account groups or to group owners (the Company of the account group): accounts of other groups are then left to the server as if the plugin were not installed.
The licence is a subscription in CPlugin Toolbox (Billing, Licenses); the pairing code to attach it to your server is in the server journal (see Upgrading for the steps, which are the same for a new installation). Pricing is shown in Toolbox. The plugin is licensed under the CPlugin Server Plugin Licence Agreement.
When the licence file is read. The plugin reads CPlugin.AMF.license (and a revocation saved next to it, if any) when the plugin starts, before it handles the first request, and keeps the licence in memory; the daily contact with the update service renews it and saves the renewed file. Deleting the file on a running server changes nothing until the plugin is restarted. To stop the plugin at once, set Enable=0 in the MT5 Administrator; that takes effect immediately.
If the part of the plugin that talks to our update service cannot start, the plugin says so in the journal and keeps using the licence file next to it until the end date written in the file (no delivery, no renewal, no trial); restarting the plugin tries again.
Free trial
You do not need to register or to ask for anything to try the plugin. On its first start the plugin contacts our update service (update.cplugin.com, TCP 443) and receives a trial licence automatically, when a trial is available for this product.
| What you get | The full plugin: every rule, no limit on the number of trades. |
| Reinstalling | Does not restart the trial: moving the plugin, deleting its files or creating a new installation on the same server keeps the original end date. |
| Extending | On request to CPlugin support (contact). |
| Needs | Outgoing access to update.cplugin.com:443. The trial licence is valid for 48 hours and is renewed at every contact with the update service, so a server that cannot reach the update service does not run a trial. |
The server journal shows the trial state and its end date, with a link to buy a licence.
What the plugin sends
In one sentence: the plugin tells our licence service which copy of the plugin runs on which trading server, so that your licence can be matched to that server, and nothing else. We never collect user data: nothing about your clients or traders.
It happens when the plugin starts and then once a day, over the internet to update.cplugin.com (port 443). Each time the plugin sends:
| What | What it is in plain words | What it is NOT |
|---|---|---|
| The plugin's own key | A random code that the plugin generates by itself the first time it starts (file CPlugin.AMF.hub.key). It is the "name tag" of this one copy of the plugin, so we can tell your copy from another customer's copy. Example: a3f9...c71d. | It is not a password, not an account number and not a licence of MetaTrader or of any other software. It is not taken from your trading server at all. |
| Licence state | Whether this plugin is licensed or running as a trial, the number of that licence or trial, and the last day it is valid. Example: "trial, valid until 2026-11-11". | The licence file itself is not sent. |
| Server names | The owner name and the server name of your trading platform as the MT5 server reports them (the names in your MetaQuotes server licence). Example: "Acme Brokers Ltd" and "Acme-Live-1". We need them to attach the licence to your server. | Only these two names are read. Nothing else from your server settings or licences is read or sent. |
| Versions and times | The version of this plugin, the version and build of your trading server and the times the plugin started. |
What is never sent: anything about your clients or traders (names, e-mails, phones, documents), accounts (logins, passwords, balances, equity, groups), orders, trades, prices, plugin settings, server journals, or the contents of your trading server database. The plugin has no way to send them: the message to our service simply has no place for such data.
Two more things to know. Our service sees the internet (IP) address the request comes from, as every web service does. And it never connects to your server and never sends it commands or programs: it only replies to requests that the plugin itself makes.
The complete official list of everything that is collected, the reason for each item and how long it is kept is on the telemetry page. The plugin also writes this notice and the link to your server journal every time it starts.
When a trial or a licence ends
Nothing breaks. Without a valid licence for an account's group the plugin does not intervene. Requests are handled by the server as if the plugin were not installed: no Stop Loss is required, no extra margin is reserved, no premium is charged, no comment is set. Trading never stops because of the plugin.
There is no separate "demo mode" with a limited number of trades: the trial is the full plugin for a limited time.
Margin already raised stays. A position that was opened while the licence was in force keeps the margin the plugin set for it (the loss at its Stop Loss) until the position is closed, or until its Stop Loss is changed while a licence is in force again. The plugin does not lower margins of open positions by itself. Premiums already charged are not returned.
Troubleshooting
| What you see | Reason and what to do |
|---|---|
| Nothing is checked at all | Enable=0; or the settings were rejected (look for config: rejected and the lines before it); or there is no licence or trial for this account's group; or no rule line covers this account group and symbol; or the line has minSL=0 or maxSL=0. Set Verbose=4: every request that is not checked says why (disabled, unlicensed, no rule line, is inactive). |
config: <parameter>: ... errors | The new settings were not applied; each line names the parameter and the problem. |
config: rejected (...); configuration version N stays in force | Your last change in the Administrator contained an error; the previous settings still work. |
there is no valid configuration, the plugin does not intervene | The server started with invalid settings. Correct them. |
| Requests rejected as Invalid stops | No Stop Loss, or the distance is outside minSL and maxSL (remember: points, not pips), or the client tried to increase the loss. |
| Requests rejected as No money | The free margin before the trade is lower than the larger of the normal margin and the maximum loss at the Stop Loss. |
| Requests rejected as Invalid volume | maxP would be exceeded; the journal shows maximum volume reached: <after> / <limit>. |
| Requests rejected as Trade disabled | Reject Pending Stops=1 and the account group matches Reject Pending Stops - Groups. |
A folder mask such as Forex matches nothing | The mask is compared with the symbol path, which includes the symbol name. Use Forex\*. |
premium ... not charged | The free margin did not cover the whole premium, or the conversion rate was not available; nothing was charged. |
line Preset[i][j] is inactive: minSL/maxSL is 0 | The line performs no checks. Use 1 instead of 0 for "no real minimum". |
| After replacing the DLL the old version still runs | The plugin stays loaded until the server process ends. Restart the MT5 trading server and check the "has been initialized (ver. ...)" line. |
FAQ
Does the plugin change the price at which my stops are executed? No. Execution stays with the MT5 server. The plugin only accepts or rejects requests and sets margin.
Does it make us compliant with AMF? No tool can do that for you. The plugin is a technical tool that applies the rules you configure; compliance remains the broker's responsibility.
Does it work on netting accounts? Yes. Closing is never blocked; only the part of an order that opens new exposure is checked. See How the rules work in detail.
Why does a folder mask like Forex match nothing?
The symbols groups field is compared with the symbol path. Write Forex\*.
Can I use 0 as "no minimum"?
No: a line with minSL=0 or maxSL=0 checks nothing. Use 1.
Can I switch rules for news time?
Yes. Keep a second preset and change Current Working Preset; the change is applied immediately.
Does the plugin need a MetaTrader licence or change mine? No. The plugin's licence is for using the plugin on your trading server only.
Does the plugin read my clients' data? It does not send any (see What the plugin sends).
Limitations and differences from the MT4 edition
- Orders are checked by the plugin only for accounts and symbols that a rule line covers.
- The
maxSLlimit is checked when the order is placed or opened, not when it is modified. - A pending order that only reduces or closes a netting position is never checked.
- One DLL file runs one plugin configuration.
- Margin that the plugin has raised stays with the position after the licence ends (see When a trial or a licence ends).
| MT4 edition | MT5 edition | |
|---|---|---|
| Premium comment parameter | Commission Comment (capital C) | Commission comment (small c) |
| Selecting symbols by group | symbols groups is a mask over the symbol group (security group) names (Forex) | symbols groups is a mask over the symbol path (Forex\*) |
| Account types | Hedging only | Hedging and netting accounts |
| Maximum comment length | 31 characters | 31 bytes in UTF-8 (15 Cyrillic letters) |
[Guaranteed SL Triggered] comment | Written only after the premium has been charged | Written when the account and symbol are covered by an active rule line; it does not say that a premium was charged |
| Error names | Invalid stops 130, Not enough money 134, Invalid volume 131, Trade is disabled 133 | Invalid stops 10016, No money 10019, Invalid volume 10014, Trade disabled 10017 |
| Free trial length | 14 days, extendable once by 14 days | Shown in the journal on the first start |
| Dealer requests | Not checked for the Stop Loss | Follow the same rules as the client's (a request with skip margin check is not checked for margin) |
Changelog: version 2.00
Licence
- The plugin is its own product, AMF MT5. The licence comes from the CPlugin update service; the licence file
CPlugin.AMF.licenseis delivered and renewed automatically. - Subscription in CPlugin Toolbox; pairing code from the journal. Licence files of version 1.22 are not read.
- A free trial is issued automatically on the first start when one is available.
- There is no demo mode any more: without a licence the plugin does not intervene.
- When a trial or a licence ends, trading never stops.
Changed behaviour
| Area | What changed |
|---|---|
Enable=0 | Switches the plugin off completely. |
| Settings | Checked as a whole; any error means none of the new settings is applied. Every problem is listed in the journal. |
| Example parameters | The examples MT5 fills in when the plugin is added are valid lines with Enable=0. |
minSL=0 or maxSL=0 | Still performs no checks, now with a journal warning at every load. |
| Masks | An exception with ! excludes wherever it stands in the list; case-sensitive; spaces at the end of a mask are ignored; a mask longer than 255 characters or with a control character is an error. |
maxP | A fraction finer than 0.00000001 lot is cut to that precision; a positive maxP that becomes 0 that way is an error. |
Reject Pending Stops | Forbids Sell Stop as well as Buy Stop. |
maxP counting | Counts the real volume of the positions with exactly this symbol name; hedging and netting accounts are handled as described above. |
| Margin | The requirement is compared with the free margin before the trade. The value of one point comes from the server's own profit calculation, so symbols that move in steps larger than one point are handled correctly. The loss is counted to 0.01 point. A Stop Loss in profit does not raise the margin. |
| Missing answers | When the server cannot answer (margin, profit, positions), the plugin does not intervene and writes the error to the journal. |
| Premium | Charged once per closing deal, from the volume of that deal; everything is checked before the money moves; a failed commission deal is not repeated; a long comment text is shortened so that the ticket is always kept. |
| Pending orders | Moving the order price away from its Stop Loss, also together with a Take Profit change, is rejected. A pending order that only reduces or closes a netting position is no longer checked when it activates. |
| Dealers | A dealer's change of a Stop Loss follows the same rules as the client's. |
| Closing | Never blocked: on netting accounts an opposite order that only reduces or closes the position is accepted without a Stop Loss. |
| Margin after fills | The server sets the normal margin of the position; the plugin only raises it when the loss at the Stop Loss is larger, and never lowers what the server set. |
| Requests without a Stop Loss | Rejected even when the current price is not available. |
| Numbers | Read exactly: maxP=3.1 allows exactly 3.10 lots; a premium of 1.005 per lot is charged as 1.01. A tiny positive minSL or maxSL keeps the line active. |
Commission comment | The limit is 31 bytes of UTF-8 (15 Cyrillic letters). |
| Restart | Replacing the DLL needs a restart of the MT5 trading server. |
| Licence reading | The licence and a revocation saved next to it are read when the plugin starts, before the first request. |
Getting the plugin
Files can be downloaded from the CPlugin NuGet feed: CPlugin.MT5Plugin.AMF versions. Please install version 2.00 or later; this guide describes that version only.
Questions about the plugin, a trial extension or moving an existing subscription: contact us.

