Real Trade Copy. Description and settings

10 апреля 2022, 10:16
Yuriy Bykov
4
1 854

Description

Real Trade Copy is a utility Expert Advisor for copying trades from one MT5 or MT4 account to another MT5 or MT4 account. Versions to run on MT4 and MT5 are different.

This Expert Advisor remains on the Market for now, but further development will take place in two other products:

  • Trade Volume Copy MT4 / MT5   - implements volume copying mode. Similar to RTC only with a graphical settings interface . The first version, which implements the main functionality, has already been released, and the main settings interface will be further developed.
  • Trade Position Copy MT4 / MT5   - implements the mode of copying individual positions (orders in MT4). This mode opens up many new options for setting up the copier operation, which are not available in the volume copying mode: setting your own levels of SL, TP, breakeven, pausing copying, filtering copied positions by various criteria, and so on. There is no such mode in RTC. First version will be posted soon


You can copy positions between Netting and Hedging accounts in any combination. You can set filters by the name of the instrument and the magic numbers of positions that will be copied. So far, the source sends information only about market positions. Pending orders are processed at the moment they become open market positions.

On one terminal, the adviser is launched in the Sender mode, on the other - in the Receiver mode.

The terminals must work on the same server so that they have the same shared data folder through which they communicate.

Installation order:

  1. In the terminal of the sender's account, launch the Expert Advisor, specifying in the parameters:
    • Run as = SENDER->
    • Sender name = [any name suitable for a filename]. You can make it empty, then the sender's trading account number will be used as the name.
  2. We wait until the launched sender displays "Status: OK" in the chart window
  3. In the terminal of the recipient account, launch the Expert Advisor, specifying in the parameters:
    • Run as = ->RECEIVER
    • Sender name = [name chosen for the sender].
    • Other options for the recipient (details below) .
  4. We are waiting   until the running receiver displays "Status: OK" in the graph window or look in the logs for the description of the error if "Status: ERROR"
To copy MT5 -> MT4 you can use Real Trade Copy MT5 as Sender and Real Trade Copy MT4 as Receiver.

To copy MT4 -> MT5 you can use Real Trade Copy MT5 as Receiver and Real Trade Copy MT4 as Sender.

You can run the Expert Advisor in Sender mode on a real and demo account without any risk, since it does not perform any trading operations. It is even possible not to issue permission to trade in the parameters, this will not interfere with its correct operation.

Before using the Expert Advisor in Receiver mode on a real account, it is highly recommended to select the necessary parameter values on a demo account with parameters similar to a real account.

Pay extra attention to the correct setting of parameter 2.1.1. Ratio, if different currencies are used on Sender and Receiver trading accounts.

Important Principles

During the creation and further development, the following basic principles were used:

  • Receiver works alone .
    It is advisable to use the trading account on which the Receiver works only for copying trades and only from one Sender.
    In the future, we plan to add the ability to copy trades from several Senders.
    It is not recommended to conduct simultaneous trading manually or by launching other Expert Advisors.

    But this is not always convenient, therefore, if this principle still cannot be observed, then you can try to do the following.
    If you use a Hedging account, then in principle, you can do whatever you want on it, simultaneously with the work of the Receiver, if other Expert Advisors do not use its Magic.
    This also applies to other Receiver instances - with different Magic values, they should work smoothly on the same Hedging account.
    If you accidentally close a position opened by Receiver, it will reopen it (but one more spread will be lost).

    There is no solution yet for Netting accounts, so using Receiver with simultaneous manual or automatic trading can lead to unpredictable results.

  • Volumes are copied. Constantly.
    Sender saves information about open volumes, not events of opening and closing positions.
    Therefore, Receiver constantly maintains the required volume of open positions for each instrument.

  • Pending orders are not copied.
    The current implementation does not provide for this possibility due to difficulties in ensuring the accuracy of copying in case of possible differences in quotes on the Sender and Receiver accounts.
    For example, situations are potentially problematic when a pending order has already turned into an open position on the Sender, but not yet on the Receiver. Or vice versa.
    Perhaps this will be resolved when adding a new copy mode - Each Position.
    But when turning any pending order into an open position, it will be immediately copied.

  • SL and TP are not copied.
    Only virtual SL and TP are used - as soon as SL or TP is triggered on the Sender and closes some volume, the corresponding volume will be closed on the Receiver as well.
    This is done to protect against re-opening positions when SL or TP is triggered on the Receiver without triggering on the Sender.

Parameters 2.3 and 2.4 have been added to further emphasize these principles (see below). If a discrepancy between their values is detected, the adviser will not perform any actions.
This is done solely for the purpose of preventing possible damages from misuse, and not to create any artificial restrictions.

If any of this seems wrong, write in the comments.

1. General parameters

1.1. Run as : Run mode.

  • SENDER ->: as a sender,
  • ->RECEIVER: as recipient,
  • SELF<->COPY: as a volume multiplier on an account with Hedging (not tested yet)

1.2. Sender name : The name of the sender. Under this name  the Sender stores information about the positions, and the Receiver looks for this information.
On the Sender, this parameter can be made empty (removing the default value 'account') - in this case, the Sender's trading account number will be used as the name.
On the Receiver, this parameter must be specified and match one of the names of already running Senders.

1.3. Symbols, separated by ';' : names of trading instruments whose positions will be copied. Separated by ";"
For example:   EURGBP;EURUSD;GBPUSD

If the instruments are named differently on the Sender and Receiver, you can first specify the name of the instrument on Sender and then the name of the instrument on Receiver , separating them with "="
For example:   EURUSD_x=EURUSD;GOLD=XAUUSD

You can mix these two options.
For example:   GOLD=XAUUSD;EURGBP;EURUSD;GBPUSD

If the value is not specified, then the Sender will send all symbols, and the Receiver will accept those symbols that were in the Market Watch list at the time of launch.


2. Receiver parameters

2.1 How to calculate volumes on receiver (R_vol)? : Method for calculating position volumes on the receiver. One of three ways is possible.

  • Use balances, leverage and ratio: the ratio of balances and leverage on the recipient and sender is calculated and multiplied by the Ratio coefficient. If the leverage on the recipient is greater, then their ratio is considered equal to 1.


    R_vol = S_vol * Ratio * (R_bal / S_bal) * (R_lev / S_lev) ,
    where  
    R_vol - position volume on Receiver
    S_vol - position volume on Sender
    Ratio - coefficient from parameter 2.1.1
    R_bal - trading account balance on Receiver
    S_bal - trading account balance   on Sender
    R_lev - leverage of the trading account on Receiver
    S_lev - leverage of the trading account on Sender

  • Use balances and ratio: the ratio of balances on the recipient and the sender is calculated and multiplied by the Ratio coefficient.


    R_vol = S_vol * Ratio * (R_bal / S_bal)

  • Use fixed ratio: position volumes on the sender are multiplied by the Ratio coefficient.


     R_vol = S_vol * Ratio

2.1.1 Ratio : ratio for formulas above.
Using this factor with a value other than 1.0 may be necessary in two cases:

  • If different currencies of trading accounts are used on Sender and Receiver.

    For example, suppose you use RUB on Sender and USD on Receiver. Both accounts received 1,000 USD each (which conditionally turned into 100,000 RUB on Sender). Then the ratio of balances
    (R_bal / S_bal)   = 1000 / 100000 = 0.01.
    In this case, you need to set Ratio = 100 in order to open positions on the Receiver of the same volume as on the Sender. If this is not done, then positions on the Receiver will not be opened for small volumes on the Sender, since their size, reduced by 100 times, will most likely be less than the minimum possible position size on the Receiver.

    In the opposite situation, let's assume that USD is used on Sender and RUB on Receiver. Both accounts were again deposited 1,000 USD each (which conditionally turned into 100,000 RUB, but now on Receiver). Then the ratio of balances
    (R_bal / S_bal)   = 100000 / 1000 = 100.
    In this case, you need to set Ratio = 0.01 in order to open positions on the Receiver of the same volume as on the Sender. If this is not done, then for small volumes on the Sender, positions on the Receiver will open 100 times larger, which is  very dangerous.

  • If you need to proportionally change the size of positions on the Sender compared to the Receiver.

2.2. What will be copied? : So far, only the first option has been implemented - copying the total volumes of open positions

2.3. Reopen manualy closed positions : Automatic opening of manually closed positions. So far, only the True mode has been implemented.

2.4. Allow manual or other EA trading : Correct operation is possible with parallel manual trading only on Hedging accounts.
For Netting accounts, this parameter must be set to False

2.5. Open Pending Orders (PO) instead Positions : Enables a mode where instead of opening positions at the current price, pending orders will be opened at the best price.
In this case, for each position opened from a pending order, the profit will be higher, but the further the order is placed from the current price, the less likely it will be able to turn into a position.
For this mode, you can set your own Stop Loss and Take Profit levels. When these levels are reached, the position will be closed on the Receiver and a new pending order will be immediately placed.
When closing positions on the Sender on the Receiver, pending orders will first be deleted and only then, if the required volume has not yet been closed, open positions will be closed.

2.5.1. Price delta for PO:   The distance at which a pending order will be placed from the current price.
In this and the following parameters for pending orders, you can specify either one numeric value that will be used for all instruments, or several numeric values separated by a ';' symbol. In this case, the number of values must necessarily match the number   instruments specified in parameter [1.3. Symbols] or with quantity   tools   in Market Watch if this parameter is empty. The order of the values must match the order of the instruments.

2.5.2. Stop Loss for PO:   Stop Loss for pending orders

2.5.3. Take Profit for PO: Take Profit for pending orders

2.5.4. Time for reopen PO:   Expiration time of pending orders (in seconds), after which they will be placed again


3. Filter options for the Receiver

3.1. Magics, separated by ';' or empty for all : filter positions by magic number. If the value is non-empty, then only the listed numbers are allowed


4. Security settings

4.1. Minimal Margin for open new Positions : Minimum margin at which new positions will be copied.
If the margin is less than this value, then the Receiver will only close existing positions. When the margin becomes larger, positions will be opened again.


5. Technical settings

5.1. Update on :   The mode of updating information about positions.

  • Very Fast Timer (every 200 ms) - 5 times per second,
  • Fast Timer (every 500 ms) - 2 times per second,
  • Medium Timer (every 1000 ms) - 1 time per second,
  • Every Tick - when the OnTick event occurs


To protect against simultaneous launch of Expert Advisor instances with the same Magic and Run As in the same terminal, a global variable is created in the terminal with a name like RTC_<Run as>_<Magic>.
Sometimes, if the terminal does not shut down correctly or if an EA running in debug mode is forced to terminate, when the EA is added again, an erroneous message may appear that the EA with such parameters is already running. In this case, after checking that there really is no instance of an Expert Advisor running on some chart with such parameters left in the terminal, it is enough to delete this global variable.


This post will be updated as it develops.


Поделитесь с друзьями: