The Expert Advisor repeats trades a preset number of times on your account.
The following functions are supported: custom lot for duplicate trades, copying Stop Loss, Take Profit, use of trailing stop.
It repeats all deals opened manually or by another Expert Advisor.
Version of the Duplicator for the MetaTrader 5: Exp5 Duplicator
Advisor is sufficient to install on 1 currency pair. By default, it will monitor all open symbols.
The Idea of the Expert Advisor
The Exp Duplicator assistant EA repeats positions opened in the terminal. It can work both with manual positions and those opened by another EA. The position or the order to be copied is called source. The repeating position is a duplicate.
The EA repeats the source the specified number of times. It copies lot, Stop Loss, Take Profit, order placing price (for pending orders) and expiration. When a source is modified, SL and TP of a duplicate are also modified.
The EA is highly customizable. To get started, you must specify the types of the copied positions and orders in the first parameters.OrderToDuplication - order type:
- 0 = BUY
- 1 = SELL
- 2 = BUYLIMIT
- 3 = BUYSTOP
- 4 = SELLLIMIT
- 5 = SELLSTOP
- All Orders
MagikToDuplication - the magic number of the order to copy, multiple magic numbers can be specified separated by commas:
- 0 - manual orders;
- 123,345,147 - all positions with magic numbers 123,345,147;
- -1 - all magic numbers.
SymbolToDuplication - the symbol of the order to copy:
- An empty value means that all positions and orders of all symbols will be copied;
- 0 - only the current symbol;
- EURUSD - only positions and orders for EURUSD.
- LotDuplicate - if 0 repeats the source lot, otherwise a custom value;
- MinLotToDuplicate -minimum lot to copy;
- CommentToDuplication - comment for duplication;
- CopyOnlyLossPosPoint - Duplicate only those transactions, the loss of which is lower than CopyOnlyLossPosPoint in points;
- CopyOnlyProfPosPoint - Duplicate only those transactions, which is higher than the profit CopyOnlyProfPosPointv points;
- ReverseDuplicate -true - reverse trades;
- KoeficientLotDuplicate - lot multiplier; 0 - no multiplier;
- StopLossDuplicate - if 0 repeats the source Stop Loss, otherwise a custom value;
- TakeProfitDuplicate - if 0 repeats the source Take Profit, otherwise a custom value;
- MaximumDistance - price deviation; 0 - any value is copied, if greater than 0 - that's the max difference between the source price and the current one;
- CloseDeleteCopy - true - delete and close duplicate orders and positions if the source ones are closed;
- KolDuplicate - the number of duplicate times.
Additional EA Parameters:
- MarketWatch - MarketWatch trading mode, true = first positions are placed without stop levels, then are modified;
- Magic - the identifier of EA's trades;
- Slippage - slippage value;
- TrailingStopUSE - use trailing stop;
- IfProfTrail - use only for profitable positions - breakeven mode;
- TrailingStop - trailing distance, 0 - minimum allowed value on the server;
- TrailingStep - trailing step.
ReverseSLTP - reverse Stop loss and Take profit when reversing deals:
When copying and reversing deals from the main deal, stop loss\take profit are also reversed on the duplicator
the main deal if SELL with stop loss = 100 points, take profit = 300 points. the duplicator copies: BUY with a stop loss of 300 points and take profit = 100 points.
When copying and reversing deals from the main deal, stop loss\take profit are not reversed on the duplicator, but set according to the stop values on the master
the main deal if SELL with stop loss = 100 points, take profit = 300 points. the duplicator copies: BUY with a stop loss of 100 points and take profit = 300 points.
- New parameter in the EAPADPRO block: SecondsToRefresh - the frequency of chart info refresh.
Default is 10 seconds! This allows to avoid too much CPU load.
Added the MilliSecondsTimerForMonitoring parameter for the EA calculation in milliseconds.
MilliSecondsTimerForMonitoring=500 means that the EA checks all trades every half a second.
Added the DuplicateOnlyInDrawDown parameter for filtering the EA operation.
DuplicateOnlyInDrawDown - the EA operation only when the account is in a drawdown.
The drawdown is calculated based on the maximum recorded account balance.
It is possible to specify the balance for calculation in the StartBalance variable. 0 - the EA will automatically calculate the maximum account balance.
When this feature is enabled, the following happens:
The duplication starts only when the balance (AccountBalance()) decreases. If the balance recovers, duplication of new orders is suspended until the new drawdown. If the balance grows, the drawdown is calculated based on the new maximum level.
In other words, duplication of new orders (from the moment of receiving a balance drawdown) starts only when positions are closed in a loss.
Added a new block - Clients TPWCM EXTRA SETS Stops when Master Close Pos.
When the block is enabled: If a position is closed on the source, the position will not be closed on the duplicator. Instead, a trailing stop or breakeven function starts on the duplicator for that position.
That is, instead of closing, the duplicator allows trailing the position further.
In this case, the trailing stop settings are individual. It is enabled only when the position is closed on the source.
Note: When enabled, this function automatically disables the CloseDeleteDuplicate function
TPWCM_TakeProfitWhenCloseMaster - parameter to set the take profit for the trades that remain after source positions are closed;
After a trade is closed on the master - it is possible to set a take profit based on the closing price of the source trade without closing it on the duplicator;
If set to true - the EA places take profit after the trade is closed in the source and in the positive area only. If the trade is unprofitable after it is closed in the source - take profit will not be placed until it is in the positive area;
If set to false - the EA places take profit in any area (even negative one).
TPWCM_StopLossWhenCloseMaster - parameter to set the stop loss for the trades that remain after source positions are closed;
TPWCM_TrailingStopUSE - enable trailing stop\breakeven for the duplicator trades after the source trades are closed;
PWCM_IfProfTrail - stop loss is trailed only in the positive ares;
TPWCM_TrailingStop - trailing stop distance;
TPWCM_TrailingStep - trailing stop step;
TPWCM_BeZubitok - enable breakeven for the duplicator trades after the source trades are closed
TPWCM_LevelWLoss - set the stop loss at the level of Open price +- TPWCM_LevelWLoss points;
TPWCM_LevelProfit - set breakeven when the position is in TPWCM_LevelProfit points of profit;
If signal provider starts going into a noticeable drawdown, the deposit may not withstand. In the most stressful situations, it is possible to completely disable copying (OnlyCloseOrders=true) and disable opening duplicate orders to avoid overloading the deposit. The EA will stop opening new positions, but will still close positions opened earlier. If their original (master) position is closed by the signal provider.
Fixed working with long tickets
- Added parameter
MaxSpreadToNotTrade and MinSpreadToNotTrade
MaxSpreadToNotTrade - Maximum spread, at which the EA can copy a grid
MinSpreadToNotTrade - Minimum spread, at which the EA can copy a grid
- Added the EAPADPRO information panel
Details on the panel in our blog:
Close All positions duplication
Close Profit duplication
Close Loss duplication
New EA parameter:
CloseOriginalifDuplicationCloseinProfit - close source position, if the duplicate position was closed with profit. Profit coverage of duplicate and source positions.
E.g. if ReverseDuplicate=true and KoeficientLotDuplicate=2, after opening a sourc eposition the EA will repeat it with a reversal and a double lot.
Further, if the duplicate position is closed with a profit and this profit covers the loss of the source position, the EA will close the source position.
New EA parameters:
These parameters adjust automated lot and free margin calculation.
If 'true', all master positions are duplicated. If any of the positions was closed, the EA duplicates it.
If 'false', no duplication is performed.
Added the OnlyNewPositions parameter allowing you to duplicate only positions that were cancelled after starting the EA.
If 'true', the EA copies new trades only, while the previous ones are skipped.
CommentToDuplication = a comment for deals to be repeated. For example: CommentToDuplication="The X" - in this case the EA will only repeat the deals opened with the comment "The X"
You can also specify a part of the deal comment.
For example, your deals have the following comments: TickSniper 1 ,TickSniper 2, TickSniper 3,
You can enter CommentToDuplication="TickSniper", then all deals with the TickSniper word in the comment will be repeated on the account.
Added reverse Orders(with ReverseDuplicate=true)
Added options for duplicate conditions:
CopyOnlyLossPosPoint - duplicate only the items that are less than the specified loss in points (indicated with a minus), 0 - off.
CopyOnlyProfPosPoint - duplicate only the items exceeding the specified profit in points, 0 - off.