Delayed Swaps plugin for MT4

User guide for the Delayed Swaps server plugin for MetaTrader 4: how it postpones swap charges, the manager account mirror, installation, every configuration parameter and the free trial.

Delayed Swaps for MT4 is a server plugin (CPlugin.DelayedSwaps.dll) that postpones swap charges: a position pays no swap until it has been open for the number of days you set. Optionally, every swap charged or paid to a client is mirrored on one account of yours (the swap account). The MetaTrader 5 edition has its own guide: Delayed Swaps plugin for MT5.

What it does

Every night the trading server calculates the swap of each open position and asks the plugin first:

The position is…What happens to the client's swapWhat happens on the swap account
younger than Days full daysno swap tonight — skipped for good, never collected laternothing
Days full days old or oldercharged or paid as usual, including three days on the triple-swap nightmirrored per the rules below
outside Groups/Symbols, or no licencecharged or paid as usual — the plugin does not touch itnothing

"Full days" are whole 24-hour periods since the position opened. The plugin never changes a swap rate, never collects a skipped swap later, never touches balances other than the swap account, and never moves money with a currency conversion.

Servers that reopen positions at end of day (rollover mode reopen by bid/close price) give a reopened position a new opening time, so its age for Days restarts every night — it never leaves the delay. Use Groups/Symbols to keep such positions out, or set Days=0.

Installation

Check the prerequisites

Visual C++ Redistributable for Visual Studio 2022 must be installed on the server.

Download the plugin

The latest file can be downloaded directly: CPlugin.DelayedSwaps.dll.

Deploy

Stop the MT4 server, copy the DLL into the server's plugins folder, and put your settings into CPlugin.DelayedSwaps.ini (start from the shipped .example file). The plugins folder must be writable by the server process: the plugin keeps its licence and key files there. Allow outgoing connections to update.cplugin.com on TCP port 443, then start the server.

The configuration and the licence are named after the DLL itself: renaming the DLL means renaming the .ini and .license files the same way, and a renamed copy counts as a separate installation.

Settings

Settings live in CPlugin.DelayedSwaps.ini next to the DLL and can also be changed in MT4 Administrator (Plugins) without a restart. Missing parameters are added with their defaults on start.

ParameterDefaultMeaning
Days30Full days a new position pays no swap. 0 switches the delay off (swap account rules still apply). 0..36500.
Swap Account0Login of the account that receives the mirror operations. 0 — no operations. Must exist and share the client's deposit currency, or nothing is posted for that client.
Swap Account ChargedcreditWhat the swap account gets when the client pays a swap: credit receives the amount, debit takes it, none does nothing.
Swap Account CrediteddebitWhat the swap account gets when the client receives a swap: debit takes the amount, credit adds it, none does nothing.
Groups*MT4 group masks; ! excludes.
Symbols*MT4 symbol masks (names or symbol groups); ! excludes, and a symbol excluded by name stays excluded even if its group matches a later mask.

Each mirror operation is a balance operation on the swap account with the comment Swap L<login> #<ticket>. On the triple-swap night the server hands the plugin the full three-day amount; the plugin never multiplies it itself.

A wrong setting rejects the whole file, named in the journal (settings (set): parameter 'Swap Account': not_integer (...)) — the previous settings stay in force. If the server starts with wrong settings, the plugin does not intervene at all until you fix them.
Unticking the plugin in MT4 Administrator does not stop it until the server restarts (the flag is only read at startup, checked on MT4 build 1492). To stop it without a restart, set Days=0 and Swap Account=0 instead.

Server journal

LineMeaning
settings (...) accepted: Days=..., Swap Account=..., ...settings taken into force
settings (...) rejected: ...settings refused
rollover check: ticket ... value ... -> ...the first 20 positions after every start
rollover summary: calls=... deferred=... left_to_server=... posted=...at most once a minute during the nightly swap run
posting REFUSED by the server: ...a swap account operation was refused; the client's swap is unaffected
no licence in force since start / licence no longer in forcethe plugin does not intervene

Licensing

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.DelayedSwaps.license next to the DLL, delivered and renewed automatically by the update service (or installed by hand), and can be limited to certain account groups or group owners.

Free trial

You do not need to register or to ask for anything. On its first start the plugin contacts the CPlugin update service (update.cplugin.com, TCP 443) and receives a trial licence automatically: 14 days of the full plugin, no limit on positions or swaps delayed, with one extension of 14 more days on request to CPlugin support. The trial licence is valid for 48 hours at a time and renewed at every contact with the update service — a server that cannot reach it cannot run a trial.

When a trial or a licence ends, nothing breaks. Without a valid licence for an account's group the plugin does not intervene: new positions pay swaps from the first night, exactly as if the plugin were not installed.
The plugin writes a line to the server journal at every start saying what it sends to the update service. The full list — and what is never sent — is on the telemetry page.

Upgrading from version 1.x

  • A new licence is needed — version 2.00 works only with the subscription licence described above; version 1.x keys are not read. Keep your old DLL and licence key until the new version works, as the way to roll back.
  • Settings are checked strictly: a typo in a parameter name, a non-numeric value or a Swap Account that does not exist is refused instead of silently ignored.
  • Symbol masks: a symbol excluded by name (!USD*) is no longer re-included by its symbol group.