Duplicator - Duplicating signals and positions on your account

Duplicator - Duplicating signals and positions on your account

16 February 2017, 11:40
Vladislav Andruschenko
8
4 331

DUPLICATOR



Duplicator - Duplication of signals and transactions on the MT4 and MT5 terminals

If you constantly use the Signals service to copy trading signals, you are surely faced with the fact, 
that the lot sizes used for trading between the provider and the subscriber may differ. 
A provider can trade too small a lot that does not match the possibilities of your deposit, 
or vice versa, too large.

  1. This utility automatically changes the size of the lot used in the trade. 
  2. It automatically copies \ duplicates the position from the original position. 
  3. The position will be copied with the lot multiplier specified in the input parameters. 
  4. The entire process of opening and closing a position will be performed automatically, depending on the original position. 
  5. The utility will also automatically copy the stop loss and take profit values.
  6. The Expert Advisor repeats all deals on your account the set number of times.

Supports the functions: install your lot in duplicate, duplicate StopLoss, TakeProfit, use trailing stop for duplicated positions and much more.

Copies all deals that are opened manually or by another Expert Advisor. The ability to increase the lot of signals.




Warning: this is not a copyist deals between terminals. Copier deals for MetaTrader you can find here: COPYLOT MT4 or COPYLOT MT5


Principle of work of the duplicator expert

Expert Assistant  Exp - Duplicator duplicates the positions that are currently open in the terminal. The expert is able to duplicate positions. In the future, the position that you want to duplicate will be called the  source code . The duplicated position is a  duplicate .

Expert exactly repeats the source specified in the settings number of times. At the same time, the lot, stoploss, takeprofit is also duplicated. When modifying the source code on duplicates, the StopLoss and TakeProfit are also modified.


 

Examples of using:

 
There are a lot of ways to use this helper. And each trader will have his own purposes of using an assistant. I can only give examples of using expert advisor:
 
1. Let's say that if you have a partner reward system on your account and you get a spread on your account, then this assistant will be very helpful. Of course, you can open a large lot immediately and you will get the same spread in principle. But if there is a minimum number of deals on your account that must be made on the account, then the assistant    Exp - Duplicator   This will help you. A broker where you can use this helper, as well as the most   here.
 
2. Your expert advisor makes deals with lot 0.1, you can take his deal and duplicate for example 5 times with the lot of each duplicate 0.5. In this case, all other parameters remain the same. When you close the source, your duplicates also close.
 
3. You participate in the competition, where you must make at least 100 deals. But your signals can only sound 10 times. Those. 10 deals.
You can set up your expert to open 1 deal with lot 1, and   Exp - Duplicator   duplicated each trade 10 times with lot 2. This will increase the number of deals. Without losing the quality of your signals
 
4. The method is not quite correct, but if your expert advisor can make a deal with a maximum lot of 0.01, then    Exp - Duplicator   can duplicate a deal 1 time but with a lot of 0.5
 
5. When your expert advisor makes deals with your StopLoss TakeProfit -    Exp - Duplicator   It also duplicates deals but with its own Stoploss Takeprofit. And also can include a trailing stop on its duplicates.
 

 

External Variables and Settings

Expert can be customized to suit your needs. To start working, you must specify the types of duplicate positions and orders in the first settings. 


Name Description
OrderToDuplication

type of order for duplication:

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

magic number of order for duplication, magic numbers can be specified separated by commas:

  • 0 - orders opened manually;
  • 123,345,147 - all positions with magic numbers 123,345,147;
  • -1 - all magic numbers without exception.
SymbolToDuplication

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.


OnlyCloseOrders
The option allowing the EA 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 expert advisor 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.
MilliSecondsTimerForMonitoring
The parameter of calculating the Expert Advisor in milliseconds MilliSecondsTimerForMonitoring is added. 
MilliSecondsTimerForMonitoring = 500 means that the EA checks all deals every half a second.
Filter Duplicate
CommentToDuplication
CommentToDuplication = Comment for duplication. You can specify a comment for the deals for duplication. For example, CommentToDuplication = "The X" - then the EA will duplicate only those deals that are opened with the comment "The X" 
You can also enter part of the comment deal. 
for example, comments on your deals: TickSniper 1, TickSniper 2, TickSniper 3, 
You can enter CommentToDuplication = "TickSniper", then all deals where the comment has the word TickSniper will be duplicated on the account.
MinLotToDuplicate
Minimal lot, in order for deals to be duplicated. 
for example MinLotToDuplicate = 0.1 - The duplicator will duplicate positions that are higher or equal to lot 0.1
MaxLotToDuplicate
Maximum lot, in order for deals to be duplicated. 
for example MaxLotToDuplicate = 1.2 - The duplicator will duplicate positions that are below or equal to lot 1.2
CopyOnlyLossPosPoint


duplication of only those positions that are less than the established loss in points (indicated with a minus sign), 0 - disabled.

You can set 30, it will mean 30 points of loss.

CopyOnlyProfPosPoint
duplication of only those positions that are greater than the set profit in points, 0 is disabled.
OnlyNewPositions
Duplicate only new positions. New positions are those positions that were opened after the duplicator was launched.
MaximumDistance
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. 
eg: 
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

(MT4 only)


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.

StartBalance

(MT4 only)


Starting point for the function DuplicateOnlyInDrawDown

DrawDownPercent

(MT4 only)

DrawDownPercent - Percentage for DuplicateOnlyInDrawDown!

Settings Duplicate
ReopenClosedDuplicateOrder
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.
ReverseDuplicate
Reverse the duplicate type. 
For example: 
ReverseDuplicate = true 
Source code BUY, position duplicate SELL 

ReverseSLTP

(MT4 only)

Turn stop-loss and take-profit for reverse of deals: 

ReverseSLTP = true 
When you duplicate and reverse the deal from the main deal, the stop-loss / take-profit rolls over on the duplicator 
eg: 
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 deal from the main deal, the stop-loss / take-profit does not roll over on the duplicator, but it is set with stop sizes on the master 
eg: 
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.
StopLossDuplicate


The stop-loss level of the duplicate in points. 
if 0, then duplicates the stop-loss of the source, or its value;

If -1, then STOPLOSS will not be copied to the main position. The duplicate position will be set to STOPLOSS = 0;

TakeProfitDuplicate


The level of the take-profit of the duplicate in points. 
if 0, then the expert advisor duplicates the take-profit of the source, or its value;

If -1, then TAKEPROFIT will not be copied to the main position. The duplicate position will be set to TAKEPROFIT= 0;

ModifySLTPfromMainPosition

ModifySLTPfromMainPosition - Change StopLoss and TakeProfit by the levels of the main position.
If ModifySLTPfromMainPosition = true, then our program will modify StopLoss and TakeProfit every time StopLoss and
TakeProfit change at the main position.
If ModifySLTPfromMainPosition = false, then our program will set StopLoss and TakeProfit only when opening a position and
will not change these levels.

Attention!

Change is possible only when the current stop loss for SELL is higher than the opening price of the position.

Change is possible only when the current stop loss for BUY is lower than the opening price of a position.

This is done in order not to change the stop loss if it is already in profit. (Work breakeven or trailing stop)

If the TrailingStopUSE (false) is disabled in our program, then the stop loss and take profit always changes!

CloseDeleteDuplicate
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.

CloseOriginalifDuplicationCloseinProfit

(MT4 only)


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 CoefficientLotDuplicate= 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 EA will close the led position.

A Original position can be closed only when the closed duplicate position has more profit than the original position.

CloseOriginalifDuplicationClosed

(MT4 only)

Close the source position (original position) if the duplicate position was closed.
AmountOfDuplicate Number of duplicates. 
For example: 
AmountOfDuplicate = 1 
Position source 1, duplicate 1 
AmountOfDuplicate = 3 
Position source 1, duplicate 3
Lots Settings


LotDuplicate
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.
CoefficientLotDuplicate
the coefficient of the duplicate lot if 0 - then without the coefficient; 
For example: 
CoefficientLotDuplicate= 1 
Lot of source = 0.1 Lot of duplicate = 0.1 
CoefficientLotDuplicate= 2 
Lot of source = 0.1 Lot of duplicate = 0.2 
Lot of source = 0.7 Lot of duplicate = 1.4 
CoefficientLotDuplicate= 0.5 
Lot of source = 0.1 Lot of duplicate = 0.05 
Lot of source = 0.7 Duplicate = 0.35
DynamicLot
Enabling dynamic lot calculation in percent of free margin and other factors. 
LotBalancePcnt
Percentage for the dynamic lot.
RiskRate
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 Watch.
Spread LIMIT Sets
MaxSpreadToNotTrade
The maximum spread at which the EA can duplicate positions.
MinSpreadToNotTrade
Minimum spread, in which the EA can duplicate positions.
Other settings
MarketWatch
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.
Magic
The magic number of the duplicate items.
Slippage
The level of the maximum possible use in points when opening and closing positions. 

Example: 
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
TrailingStop settings
TrailingStopUSE
Enabling the standard Trailing Stop for duplicate positions.
TrailingStop
Trailing stop distance
TrailingStep
Step stoploss variation
Duplicate TPWCM EXTRA SETS Stops when Original Close Pos
TPWCM_Use 
(MT4 only)


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 opportunity 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 TPWCM block works after the original (source) position is closed, but the duplicate position will not be closed, and a stop loss / take profit / trailing stop will be installed on it

TPWCM_TakeProfitWhenCloseMaster
the parameter of setting the take-profit for duplicate deals, 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;
TPWCM_TakeProfitOnlyToProfitZone


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 deal 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.

If, for example, a position at a loss of -30 pointsand you set a take profit = 10 points and TPWCM_TakeProfitOnlyToProfitZone=false ,then when you close the source position, the take profit will be set to the level of -20 points (loss).
if TPWCM_TakeProfitOnlyToProfitZone=true  This function sets take profit only when the take profit level is in profit.

TPWCM_StopLossWhenCloseMaster
the stop-loss setting for duplicate deals that remain after the source is closed;
TPWCM_TrailingStopUSE


Enable trailing stop / Break-even deal of the duplicator, after closing of the source code deals;

difference between TrailingStopUSE and TPWCM_TrailingStopUSE:

TrailingStopUSE is always used. that is, it works constantly. If you turn it on, then duplicate trades will always be with a trailing stop.
TPWCM_TrailingStopUS is enabled only when the original position is closed. Only then the position of the duplicate will have a trailing stop.

TPWCM_IfProfTrail
Trailing stop stoploss only in the positive zone;
TPWCM_TrailingStop
Trailingstop distance;
TPWCM_TrailingStep
Step trailing stop;
TPWCM_BreakEven
Include a break-even on the duplicator's deals, after closing the deals of the source
TPWCM_LevelWLoss
Set stop loss at the opening price level + - TPWCM_LevelWLoss items;
TPWCM_LevelProfit
Set break-even when the position in the profit TPWCM_LevelProfit points;
Additional options for MT5

TypeFilling

(MT5 only)


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 

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

Example: 
FillOrKill 
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. 


ImmediateOrCancel 
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. 


Return 
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.
RoundingDigits
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. 

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



Share it with friends: