The Expert Advisor repeats trades a preset number of times on your account.
The following functions are supported: custom lot for copied trades, copying Stop Loss, Take Profit, use of trailing stop.
It copies all deals opened manually or by another Expert Advisor.
Version of the Duplicator for the MetaTrader 5: Exp5 Duplicator
It is sufficient to install the EA 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. The EA is able to copy both positions and pending orders. 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.
The main copying filters:
- OrderToDuplication - type of the order to be copied.
- MagiсToDuplication - the magic number of the order to copy, specify multiple magic numbers separated by commas or set -1 to copy all magic numbers;
- SymbolToDuplication - the symbol of the order to copy (All, 0 - current, or symbol name);
Other copying filters:
- OnlyCloseOrders - allows the EA only to close the duplicate positions, without copying new positions.
- MilliSecondsTimerForMonitoring - parameter for the EA calculation in milliseconds.
- MinLotToDuplicate / MaxLotToDuplicate - minimum/maximum lot of positions to start copying.
- CommentToDuplication - comment for copied positions.
- CopyOnlyLossPosPoint / CopyOnlyProfPosPoint - loss/profit of positions to copy.
- OnlyNewPositions - copy only the new positions (opened after starting the EA).
- MaximumDistance - price deviation for copying. 0 - copy with any deviation. If greater than 0, the difference between the source price and the current price must not exceed the specified number of points;
- DuplicateOnlyInDrawDown - the EA operation is allowed only when the account is in a drawdown. The drawdown is calculated based on the maximum recorded account balance or StartBalance.
- ReopenClosedDuplicateOrder - reopen the duplicates after closing by stop loss/take profit/trailing stop.
- ReverseDuplicate/ReverseSLTP - reverse deals/stop loss and take profit.
- StopLossDuplicate/TakeProfitDuplicate - if 0, repeats the source Stop Loss/Take Profit; otherwise, a custom value.
- CloseDeleteDuplicate - delete and close duplicate orders and positions if the source ones are closed.
- CloseOriginalifDuplicationCloseinProfit - close the source position, if the duplicate position was closed with profit greater than the loss of the source position.
- AmountOfDuplicate - the number of duplicates.
- MaxSpreadToNotTrade/MinSpreadToNotTrade - prohibit trading with higher/lower spreads.
- LotDuplicate - if 0, repeats the source lot; otherwise, a custom value.
- CoefficientLotDuplicate - lot multiplier; 0 - no multiplier.
- DynamicLot/LotBalancePercent - dynamic lot as LotBalancePercent percents of free margin.
- RiskRate - exchange rate of the deposit currency in relation to the US dollar for dynamic lot calculation.
- TPWCM_Use - if a source position is closed, the position will not be closed on the duplicator. Instead, a trailing stop or breakeven function starts on the duplicator for that position. Note: When enabled, this function automatically disables the CloseDeleteDuplicate function.
- TPWCM_StopLossWhenCloseMaster /TPWCM_TakeProfitWhenCloseMaster - stop loss/take profit.
- TPWCM_TakeProfitOnlyToProfitZone - after the source deal is closed, the EA sets take profit only in the profit area.
- TPWCM_TrailingStopUSE / TPWCM_TrailingStop / TPWCM_TrailingStep - enable trailing stop / distance / step of trailing stop.
- TPWCM_BreakEven / TPWCM_LevelWLoss / TPWCM_LevelProfit - enable breakeven / set stop loss at the level of Open price +- TPWCM_LevelWLoss points when the position has a profit of TPWCM_LevelProfit points.
Additional EA Parameters:
- MarketWatch - MarketWatch trading mode, true = positions are placed without stop levels and are modified afterwards.
- Magic - magic number.
- Slippage - slippage.
- TrailingStopUSE - use trailing stop for duplicates.
- TrailingStop / TrailingStep - trailing distance / step, 0 - minimum allowed value on the server.
- Warning: typos have been fixed in certain parameters. Check your settings if you changed them.
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.