Delayed Swaps plugin for MT5

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

Delayed Swaps for MT5 is a server plugin (CPlugin.DelayedSwaps64.dll) that postpones swap charges: a position pays no swap until it has been open for the number of days you set. After that day the server charges swaps as usual. Optionally, every swap charged after the delay produces a balance operation on a manager account you choose. The MetaTrader 4 edition has its own guide: Delayed Swaps plugin for MT4.

What it does

  • Delays swaps. At each daily rollover the server asks the plugin about every open position. While a position is younger than Days, the plugin tells the server not to charge the swap for that rollover; once it is old enough, the swap is charged by the server's own calculation, unchanged.
  • Counts whole 24-hour days from the position's open time to the rollover, in server time. A position whose open time lies in the future (the server clock was moved back) is treated as new — no swap is charged.
  • Filters by group and symbol masks.
  • Posts the charged swap on a manager account (optional), in the direction you choose for each side. The comment is Swap L<login> #<position> (or just Swap #<position> if both numbers together exceed MT5's 31-character limit).

What it does not do

  • It never changes a client's balance itself — only the server charges or does not charge the swap.
  • A delayed swap is never charged later — there is no catch-up when the delay ends.
  • It does not decide swap amounts, including the triple-swap day — that stays the server's own calculation.
  • It does not convert currencies: a manager account in another currency than the client's gets no operation for that swap.

Installation

Check the prerequisites

None for the 64-bit MetaTrader 5 trade server — no Visual C++ Redistributable is needed.

Download the plugin

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

Deploy

Copy the DLL into the Plugins folder of the MT5 trade server — the folder must be writable by the server process, since the plugin keeps its licence and its own key there. Allow outgoing connections to update.cplugin.com on port 443.

Add the plugin

Restart the server service, then in MT5 Administrator open the plugin list, add Delayed Swaps and set the parameters.

Add the plugin once per server: a second configuration of the same DLL never delays swaps and posts nothing (the journal says another configuration of this plugin module is already running).

The DLL is protected by WinLicense, a commercial code protector, so the licence check cannot simply be cut out of the file — the file is larger than an ordinary DLL and part of its code is encrypted. Protection changes nothing about how the plugin handles swaps and accounts, shows no windows and sends nothing beyond what's in What the plugin sends below.

Settings

Set in MT5 Administrator, in the plugin's own configuration (not an .ini file). Changes apply at once, without a restart.

ParameterDefaultMeaning
Days30Whole 24-hour days a position pays no swap. 0 switches the delay off. 0..36500.
Swap Account0Login of the manager account for the balance operations. 0 — no operations. Must exist on the server.
Swap Account ChargedcreditWhen the client pays a swap: credit the manager account receives the amount, debit the same is taken from it, none nothing.
Swap Account CrediteddebitWhen the client receives a swap: debit takes the amount from the manager account, credit adds it, none nothing.
Groups*Group masks, e.g. !demo*,*real*; must not be empty.
Symbols*Symbol masks, e.g. !USD*,*EUR*; must not be empty.

A configuration with an error is not applied at all — a misspelled parameter name, an empty mask, a value out of range or a non-existent Swap Account is refused as a whole (configuration error: ... / configuration rejected in the journal), and the previous settings keep working. With no previous settings, the plugin does not intervene until you fix it.

Manager account

The amount is always the swap the server charges for that rollover, rounded to the manager account's currency digits. No operation is posted when: the amount rounds to zero; the manager account is the client's own; the manager account is in another currency; the setting for that side is none; the plugin has no licence for the client's group.

How operations are posted. MT5 does not allow a plugin to post balance operations during swap calculation, so the plugin queues them and posts a few moments later from its own thread, one commission-type operation per swap. A refused operation is never repeated; the journal names it fully (posting rejected by the server [code]: manager ..., client ..., position ..., rollover day ..., amount ...) so you can post it by hand. When the server stops, the plugin finishes queued operations for up to 20 seconds — unfinished ones are listed, one line each (posting not made (stopped): ...); if the process crashes outright, queued operations are lost without such a list.

Journal

A summary line at most once a minute and when the plugin stops:

DelayedSwaps: summary: deferred=1520, left_to_server=310, queued=290, posted=288, post_failed=2, post_skipped_currency_mismatch=20; last deal #7000123
WordMeaning
deferredswaps not charged this time
left_to_serverswaps the server charged as usual
not_licensedof them: no licence for the client's group
queued, postedmanager operations prepared and confirmed
post_failed, post_unknownmanager operations refused or unknown result (each also gets its own line)
post_skipped_<reason>no operation by the rules above (currency_mismatch, rule_none, amount_zero, manager_is_client)
lost_on_stopoperations listed at stop for manual posting

Decisions about single positions are not written — there can be tens of thousands per night.

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.DelayedSwaps64.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; the plugin checks it for the client's group at every position.

Free trial

You do not need to register or ask for anything: on its first start the plugin contacts the CPlugin update service (update.cplugin.com, port 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 daily contact with the update service.

When a trial or a licence ends, nothing breaks. Without a valid licence for a client's group the server charges that client's swaps as usual, as if the plugin were not installed, and posts nothing on the manager account.
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 an earlier build

  • A licence is now required — earlier builds had no licence check.
  • New settings Swap Account Charged and Swap Account Credited; their defaults keep earlier behaviour.
  • A configuration error is no longer half-applied: an empty mask, an unknown parameter or a missing Swap Account now rejects the whole configuration.
  • The rollover time is now the time of that rollover as the server passes it, not the current server clock.