Cloud based trade copying

MQL5 Experts Scripts

Specification

Based on (https://www.fxblue.com/appstore/u4/internet-trade-mirror-sender/user-guide

It needs to send trades from a master to a server that sends the trades to slave(s)

I need to be able to link different masters to different slaves

If a slave losses/gains too much money either in a day or overall i want it to stop copying it's master (i will set these parameters)

I need it to send trade history to the server 



3.1Trade placement and closure

The Sender EA sends a message as soon as it detects that there is a new open order in its copy of MT4/5. Receiver EAs will then attempt to place the same trade.

The same applies to trade closure. As soon as it spots that a previously open order has been closed, the Sender EA tells the Receiver EAs to close their trades.

Messages are sent to the subscribers via FX Blue's message hub. The speed of copying depends almost entirely on the latency to the message hub and to your broker. Differences in price between you and the subscribers can be caused both by the latency in receiving signals and also price differentials between different brokers. Subscribers may need to adjust their AllowSlippagePips parameter in order to trade successfully, or even to turn on TradeAllOrdersAtMarket.

3.1.1Speed of processing on the receiver

Once a receiver gets a signal from your sender, it should make a request to its own broker almost immediately. The speed of trade copying on the receiver is controlled almost entirely by the speed of trade placement by the broker (including network latency to the broker), not by the internal speed of the copier.

The copier's logs will show where any delays are occurring. The copier will record the following process:

Message arriving in the receiver from your sender

Instruction by the receiver to its broker

Confirmation of the new trade on the receiver by the broker

However, there is a special consideration in MT4 (only, not in MT5). Unless your subscribers use the optional Receiver-Worker EA, MT4 can only carry out one trading action at a time, and the receiver EA cannot do anything else while it is waiting for the broker to accept or reject an instruction. If two new signals arrive in the MT4 receiver simultaneously, the receiver EA cannot start working on the second one until its broker accepts/rejects the first one.

3.1.2Stop-loss and take-profit on the receiver

The stop-loss and take-profit on a subscriber's trade are only a safeguard in case the connection with your Sender is lost. Under normal circumstances, the subscriber's trade will be closed as soon as your trade is closed. The Receiver EA's s/l and t/p are only used if either (a) the connection with the sender is lost and no close instruction is received, or (b) price differences between brokers mean that the subscriber's s/l or t/p is hit before your s/l or t/p.

3.1.3Slippage tolerance on the receiver

By default, there is a limit on the price difference which the Receiver EA will accept between your sender's price versus the receiver's price - controlled by the AllowSlippagePips setting.

If the price difference between your sender and the receiver is larger than this, the receiver will try to get your sender's price by placing a pending limit order instead of buying or selling at market. Note: the broker can have a restriction on the minimum distance between a pending entry and the current market price. A trade can be rejected (MT4 error #130) if the price difference is larger than AllowSlippagePips but smaller than the broker's stop-level.

You can turn off the slippage check by turning on the setting BroadcastAllOrdersAtMarket. This tells receivers to copy your trades regardless of any price difference.

3.2Heartbeats

N.B. The heartbeat period does not control how quickly orders are copied. Open and close messages are always sent immediately, and processed as quickly as possible.

The Sender EA sends a periodic "heartbeat" message, every 30 seconds by default. This states which orders should still be open. If a Receiver misses a trade-closure instruction, e.g. because its copy of MT4/5 is not running at the time, then it should close the order when it next receives a heartbeat from the sender.

Changes to a trade's s/l or t/p are also sent in the heartbeat message. Therefore, there may be a delay of up to 30 seconds between the s/l or t/p changing in your sender's copy of MT4/5 and the Receiver making the change. However, if the trade is closed out on the sender within those 30 seconds because the s/l or t/p is hit, that should lead to an immediate close instruction being sent to the Receiver.

Changes to the entry price on a pending order are also sent in the heartbeat, and therefore updated within 30 seconds.

3.3Pending orders

By default the Sender EA does not send pending orders. It only sends a message to Receivers once a pending order is filled and turns into a buy or sell order.

Copying pending orders is potentially very dangerous. Let's say that you are trading the breakout of yesterday's range, and you have a buy-stop at yesterday's high. This could get triggered on a Receiver without being triggered on the sender, because of slight price differences between the two accounts. If the price then retraces, the sending copy of MT4 will be unaware that the Receiver has a trade which needs to be managed, but the Receiver will have an ever-increasing loss and will not be receiving any instructions to close the position.

However, you can configure the Trade Mirror to send pending orders by turning on the optional IncludePendingOrders parameter. Subscribers can then use the RequireSenderFillWithinMinutes parameter to limit the risk at their end. If the subscriber's order is filled, but your sender's order remains pending, then the Receiver EA can be configured to close its order after this number of minutes (ignored if zero).

3.4Lot sizing and risk

Subscribers can use several different modes for determining what lot size to trade:

Risk-based: trade sizes are adjusted based on the subscriber's account equity compared to your equity

Multiple: a simple multiple of your trade size (regardless of different account equity, and therefore % of risk)

Fixed: a fixed lot size per trade

Cash-risk: a fixed cash risk per trade, or a % of account equity or balance

For more information about the options available to subscribers, please see the Receiver EA user guide.

However, in addition to the options which are available to each subscriber, you can also alter the lot size which is issued by the Sender. For example, you can configure the Sender EA's parameters to give subscribers a fixed lot size rather than the actual volume you are trading.

3.5Broker symbol names and suffixes

Symbol names are not standardised and can vary between broker accounts. For example, the EUR/USD fx pair may be EURUSD on one account and EURUSD.xyz on another. An equity index such as the DAX may be referred to as DE30, GER30, .DAX, .DE30, [GER30] etc.

In addition, some accounts may contain more than one version of each market on their symbol list - for example, both EURUSD and EURUSD+. When it receives a trade for EUR/USD, the copier needs to know which symbol it should use - and which version, if there is more than one.

The Receiver EA should almost always be able to handle fx pairs without manual overrides to its settings

The Receiver EA will often be able to handle metals, oil, and equity indices, but may require manual overrides to its settings

Other markets, particularly individual equities such as Apple or Google, will almost always require manual overrides to the Receiver EA settings

3.6Market execution

(Legacy information: some brokers use "market execution" where, in the past, it was necessary for an EA to send a trade and then send a separate instruction to add any s/l and t/p. However, in all recent releases of MT4 and MT5, EAs should now be allowed to send the s/l and t/p as part of their order-open. As a result, the old CloseOrdersImmediatelyIfSLFails setting has been removed from the copier.)

3.7Hedging vs. non-hedging

The copier can be used with both hedging and netting accounts on MT5. However, netting accounts require an extra setting to be turned on in the copier.

The copier cannot be fully used with FIFO/non-hedging accounts on MT4, because MT4 does not have proper netting accounts. If your sender opens a buy ticket and then a sell ticket (or vice versa), the first trade will be successfully copied on a FIFO/non-hedging account but the hedged trade will fail.

3.8Magic numbers

The Receiver EA uses an order's magic number to identify which orders belong to it, versus which orders are from manual trading or other EAs running on the account. Therefore, magic numbers are also not copied from the sender account.

The Receiver EA uses the same magic number for all orders which it processes. By default, it automatically selects a magic number based on the channel name. Subscribers can choose their own magic number by setting the MagicNumber parameter in the Receiver EA to something other than zero.

3.9Partial closes

The sender and receiver EAs are capable of handling partial closes.

However, this relies on brokers using the standard functionality of MT4/5. Partial closes will not be processed properly by the copier if the broker deviates from standard MT4/5 functionality:

On MT4, the copier expects a partial close to be identified by the order comment (e.g. "from #12345678")

On MT5, the copier expects the ticket number of a position to be unchanged following a partial close (i.e. ticket number remains the same, with reduced volume).

3.10Inverting trade direction

The Receiver EA can be configured to invert the sender's trade direction, turning buys into sells and vice versa. (This feature has been included at user request; we are not aware of any loss-making trading system which can be made profitable by inverting it.)

In order to use this feature, a subscriber needs to turn on the Receiver EA's InvertTrades parameter, and will also need to do one of the following:

  • Turn on the TradeAllOrdersAtMarket parameter. This means that the Receiver EA ignores the sender's entry price (because e.g. the sender is buying at the ask price whereas the receiver will be selling at the bid price).
  • Increase the AllowSlippagePips parameter, to cater for the fact that the difference between the sender's entry price and the receiver's entry price will be at least the size of the spread.

3.11Order comments

By default, the Receiver EA uses the MT4/5 order comment to track the ticket numbers on the sender account. The subscriber can change this behaviour, and get the Receiver EA to use the original comments from the orders on the sender account, by turning on the UseOriginalOrderComments parameter in the receiver.

Alternatively, the subscriber can use the UseCustomOrderComment parameter to use a fixed comment for all orders.

However, please note that these parameters have implications for disaster-recovery. If a subscriber turns on UseOriginalOrderComments or UseCustomOrderComment, then the ticket numbers on the sender account are tracked using a file on disk (in MT4/5's MQL\files directory). If this file is deleted - or is unavailable for some other reason, e.g. because the subscriber is starting up MT4/5 on a new computer in an emergency - then the Receiver EA will close all its orders because it can no longer link them to the sender's heartbeat.

3.12Controlling the Sender using MT4/5 Global Variables

You can block the Sender from placing new trades using a Global Variable in MT4/5 (press F3, or choose Tools / Global Variables).

You can use this either as a way of controlling the Sender manually, by creating and removing the Global Variable yourself, or you can have an automated system which uses the Global Variable to turn the copying on and off based on something such as account equity or performance.

The Sender is controlled by a Global Variable called Suspend-X, where X is the channel name. For example: Suspend-MySender. If a variable exists with this name, regardless of its value (zero/non-zero) then the Sender EA will not issue a message to subscribers when a new trade is placed.


Responded

1
Developer 1
Rating
(45)
Projects
59
44%
Arbitration
8
50% / 38%
Overdue
7
12%
Free
2
Developer 2
Rating
(10)
Projects
25
28%
Arbitration
2
0% / 0%
Overdue
1
4%
Loaded
3
Developer 3
Rating
(144)
Projects
198
42%
Arbitration
20
25% / 55%
Overdue
9
5%
Free
4
Developer 4
Rating
(26)
Projects
34
29%
Arbitration
0
Overdue
1
3%
Free
5
Developer 5
Rating
(63)
Projects
84
26%
Arbitration
23
22% / 48%
Overdue
23
27%
Free
6
Developer 6
Rating
(5)
Projects
4
50%
Arbitration
4
0% / 75%
Overdue
0
Free
Similar orders
I am looking for a skilled Thinkorswim script developer for a one-time project. Your task will be to combine 8 distinct Thinkorswim studies (I will provide the code for each) into one Lower Study. The final script should display histogram rows for the individual studies with a bubble color scheme of bright green, dark green, gray, dark red, and bright red
I need some who can develop my strategy and hand me over the source code... I will give you the specific area in the market i want to mark out and then set pending orders to execute once price move into the zone
C onversion from Ninjatrader to Tradingview. This includes thorough testing and debugging to guarantee that the script functions as intended on Tradingview...If you are in for this job kindly bid
I believe in Robotics as a major artificial intellect to function of growth of business.Therefore if you script there is a likelihood of bringing economies of scale.The retrospective of the dynamics of indulgence of work can be economics of scale
there I hope you're doing well I want to convert the tradingview indicator to make an indicator for mt5. And in that, I want to make an automatic robot on the base of the indicator. I have the pine script of that indicator
Looking for someone who is able to code MQL for MT5 manager plug-in? Please contact me for more info. it is mainly on when to trigger a stop out of the account
see trade open on every tick seconde ok forex pair us us30 if is current running at 40170.00 so open 2 trade buy stop and sell stop both in every tick pending order of buy stop will 40171.00 and sell stop pending order will be 40169.00 buy stop will open at 40171.00 and tp will be 40173.00 and SL will be 40169.50 ok if buy stop hit sell stop order automatically will be close now if sell stop order open at 40169.00 so

Project information

Budget
150+ USD
VAT (21%): 31.5 USD
Total: 181.5 USD
For the developer
135 USD