Duplicator - Duplicating signals and transactions at the terminal MT4 and MT5

Duplicator - Duplicating signals and transactions at the terminal MT4 and MT5

16 February 2017, 11:40
Vladislav Andruschenko

Advisor repeats all transactions on your account set number of times.

Supports functions: set your lot in duplicate, duplicate stoploss, take profit, use treylingstop for duplicated items and much more.

Copies all the transactions that are opened by hand or other adviser. The ability to increase the exhibition signals.




Warning: this is not a copyist transactions between terminals. Copier deals for MetaTrader 4 you can find here:COPYLOTorCOPYLOT MT5

The essence of the expert

Expert Assistant DuplicatorExp - Duplicatorduplicates the positions that are currently open in the terminal. The expert is able to duplicate the position. In the future, the position that you want to duplicate, will be called thesource.Duplicated item -duplicate.

Expert in exactly the same source specified in the settings of the number of times. This is also duplicated and lot, stop loss, take profit. When modifying the source code to duplicate and modified stop-loss and take profit.


The EA is highly customizable. To get started, you must specify the types of the copied positions and orders in the first parameters.


type of order for duplication:

  • 0 = BUY - position for purchase;
  • 1 = SELL - position for sale;
  • All Orders - all positions.

magic order for duplication, magics can be specified separated by commas:

  • 0 - orders opened manually;
  • 123,345,147 - all positions with magicians 123,345,147;
  • -1 - all wizards without exception.

the order symbol for duplication:

  • Empty - all positions and orders of all symbols are duplicated;
  • 0 - only the current character;
  • EURUSD - only positions and orders with the symbol EURUSD are duplicated.
The option allowing the adviser only to close already duplicated positions. 

If the signal provider starts to noticeably go into a drawdown, then the deposit may not survive. In the most stressful situations, you can generally turn off duplication ( true) and do not open new duplicate orders, so as not to overload the deposit. The adviser stops opening new positions, but at the same time closes the positions opened earlier. If their original (leading) position is closed by the signal provider.
The parameter of calculating the Expert Advisor in milliseconds MilliSecondsTimerForMonitoring is added. 
MilliSecondsTimerForMonitoring = 500 means that the EA checks all transactions every half a second.
CommentToDuplication = Comment for duplication. You can specify a comment for the transactions for duplication. For example, CommentToDuplication = "The X" - then the advisor will duplicate only those transactions that are opened with the comment "The X" 
You can also enter part of the transaction comment. 
for example, comments on your transactions: TickSniper 1, TickSniper 2, TickSniper 3, 
You can enter CommentToDuplication = "TickSniper", then all transactions where the comment has the word TickSniper will be duplicated on the account.
Minimal lot, in order for transactions to be duplicated. 
for example MinLotToDuplicate = 0.1 - The duplicator will duplicate positions that are higher or equal to lot 0.1
Maximum lot, in order for transactions to be duplicated. 
for example MaxLotToDuplicate = 1.2 - The duplicator will duplicate positions that are below or equal to lot 1.2
duplication of only those positions that are less than the established loss in points (indicated with a minus sign), 0 - disabled.
duplication of only those positions that are greater than the set profit in points, 0 is disabled.
Duplicate only new positions. New positions are those positions that were opened after the duplicator was launched.
The maximum deviation in the price for duplication, If 0 - then duplicates at any time, If more than 0 - then the deviation between the current price and the price of the source code is no more than the set points; 
Deviation is considered in both directions. 
MaximumDistance = 10, Current price = 1,12345 
Only those positions will be duplicated, the opening price of which is within the limits of 1,12335-1,12355
DuplicateOnlyInDrawDown - Advisor's work only when there is a drawdown on the account. 
Drawdown is calculated from the Maximum fixed balance of the account. 
Or you can specify the Balance, from which the calculation is made in the variable StartBalance. 0 means that the EA automatically calculates the maximum balance of the account. 

When this function is enabled, the following occurs: 
Duplication starts only when the balance (AccountBalance ()) has decreased. At the same time, when the balance is restored, duplication of new orders stops until a new drawdown occurs. If the balance sheet has grown, then the drawdown is taken from the new maximum level. 
Those. in other words, we start duplicating new orders (from the moment of drawdown on the balance sheet) only when there were closeings in the negative.
Starting point for the function DuplicateOnlyInDrawDown
The parameter ReopenClosedDuplicateOrder , which allows you to rediscover duplicate orders, if they were closed on a stop-loss or manually. 
At true, all master positions will be duplicated. If any position of the duplicate has been closed, the Expert Advisor will duplicate it again. 
If false, if the duplicated position has been closed, the Expert Advisor will no longer open it.
Reverse the duplicate type. 
For example: 
ReverseDuplicate = true 
Source code BUY, position duplicate SELL 

ReverseSLTPTurn stop-loss and take-profit for reverse of transactions: 

ReverseSLTP = true 
When you duplicate and reverse the transaction from the main transaction, the stop-loss / take-profit rolls over on the duplicator 
on the main SELL deal with a stop loss = 100 points, take-profit = 300 points. The duplicator is duplicated: BUY with a stop-loss of 300 points and take-profit = 100 points. 

ReverseSLTP = false 
When you duplicate and reverse the transaction from the main transaction, the stop-loss / take-profit does not roll over on the duplicator, but it is set with stop sizes on the master 
on the main SELL deal with a stop loss = 100 points, take-profit = 300 points. The duplicator is duplicated: BUY with a stop loss of 100 points and take-profit = 300 points.
The stop-loss level of the duplicate in points. 
if 0, then duplicates the stop-loss of the source, or its value;
The level of the take-profit of the duplicate in points. 
if 0, then the adviser duplicates the take-profit of the source, or its value;
delete and close positions and duplicate orders, when closing the source. 
When the position of the source is closed, the duplicate position is also closed.
Closing the slave position if the duplicated position was closed in profit. Overlapping the profits of the duplicated and led position. 
For example, if you set ReverseDuplicate = true and KoeficientLotDuplicate = 2, then when you open the following position, the Expert Advisor duplicates it with a coup and a double lot. 
Further, if the duplicated position of the duplicate is closed in profits and this profit will block the loss of the slave position, the adviser will close the led position.
Number of duplicates. 
For example: 
KolDuplicate = 1 
Position source 1, duplicate 1 
KolDuplicate = 3 
Position source 1, duplicate 3
Lot of duplicates. You can set your fixed lot, which will be opened when duplicating. 
Or put on 0 - then all the duplicates will be with the same lot as your positions.
the coefficient of the duplicate lot if 0 - then without the coefficient; 
For example: 
KoeficientLotDuplicate = 1 
Lot of source = 0.1 Lot of duplicate = 0.1 
KoeficientLotDuplicate = 2 
Lot of source = 0.1 Lot of duplicate = 0.2 
Lot of source = 0.7 Lot of duplicate = 1.4 
KoeficientLotDuplicate = 0.5 
Lot of source = 0.1 Lot of duplicate = 0.05 
Lot of source = 0.7 Duplicate = 0.35
Enabling dynamic lot calculation in percent of free margin and other factors. 
Calculation of our autolot.
Percentage for the dynamic lot.
RiskRate - the rate of your currency against the dollar. 
By default, RiskRate = 0 - means that the Expert Advisor will try to find the correct rate in the Market Review. 
In order for Autolot to work adequately with all currency pairs, you need to include the "Show all currency pairs" in the Market Review.
The maximum spread at which the adviser can duplicate positions.
Minimum spread, in which the adviser can duplicate positions.
It includes the ability to open positions with stop-loss / take-profit on an account with MARKET execution. 
The first opens the position, after the successful opening, the levels of StopLoss and TakeProfit are modified.
The magic number of the duplicate items.
The level of the maximum possible use in points when opening and closing positions. 

Slippage = 1 
Maximum deviation when opening a position = Opening price + -1 point. 
Slippage = 100 
Maximum deviation when opening a position = Opening price + -100 point. 
For example: The price of opening a position when sending an order to the server = 1.12345 
But, if during the time of sending and opening a position the price has changed within 100 points, then the position will open with the use of within 1.12245 - 1.12445
Enabling the standard Trailing Stop for duplicate positions.
Trailing stop distance
Step stoploss variation
(only for MT4)

TPWCM EXTRA SETS Stops when Master Close Pos 
When the block is turned on: If the position closes on the source, the position will not be closed on the duplicator. Instead, a duplicate for this position includes a trailing stop or break-even. 
Those. instead of closing on the duplicator, you have the option to include a trailing stop and accompany the position further. 
Trailing stop settings in this case are separate. And it is included only when this position is closed on the source. 

Warning: This function automatically turns off the function CloseDeleteDuplicate
the parameter of setting the take-profit for duplicate transactions, which remain after the source code is closed; 
After closing the deal on the source - there is an opportunity, without closing the deal on the duplicator, to establish a take-profit from the closing price of the deal on the source;
When it is turned on, the Expert Advisor puts the Take Profit, after closing the deal on the source, only in the positive zone. And if after the close on the source transaction in the red - then take will not be delivered until it is in the black; 
If you turn off false - the Expert Advisor will deliver the take in any case, even in the negative zone.
the stop-loss setting for duplicate transactions that remain after the source is closed;
Enable trailing stop / Break-even transaction of the duplicator, after closing of the source code transactions;
Trailing stop stoploss only in the positive zone;
Distance trailingstopa;
Step trailing stop;
Include a break-even on the duplicator's transactions, after closing the transactions of the source
Set stop loss at the opening price level + - TPWCM_LevelWLoss items;
Set break-even when the position in the profit TPWCM_LevelProfit points;
The type of fill positions and orders. 
Used for MT5 terminal. 
In AUTO mode, the Expert Advisor tries to determine the fill type automatically. But, in some situations, you need to set the fill type yourself. 
If you get an error when opening a position 

An unsupported type of execution of the remainder order is indicated. 
Set the type of fill that your broker indicates. 

This execution policy means that the order can be executed only in the specified amount. If the market currently does not have a sufficient amount of a financial instrument, then the order will not be executed. The required volume can be made up of several offers available at the moment in the market. 

It means the agreement to make a deal on the maximum available volume on the market within the limits specified in the warrant. In case of impossibility of full execution, the order will be executed for an accessible volume, and the unexecuted order volume will be canceled. 

This mode is used for market, limit and stop-limit orders, and only in the modes "Market Execution" and "Stock Execution". In case of partial execution, a market or limit order with a residual volume is not withdrawn, but continues to operate. 
For stop-limit orders, the corresponding limit order with the execution type Return will be created upon activation.
Rounding of all prices when opening and modifying orders and positions. 
Choices: No rounding, rounding up to 1 digit, Rounding up to 2 digits. 
The option is designed for Gold and Silver, as well as for brokers, where a certain accuracy of ticks is given. 

Order setting price = 1.12345 
Rounding to 1 digit = 1.12340 
Rounding up to 2 digits = 1.12300

Share it with friends: