METATRADER TO TRADELOCKER TRADE COPIER - API APPROACH

 

This is the user guide for 'MT4/MT5 to TradeLocker' Trade Copier


API Approach






Quick Note:


This copier uses TradeLocker API to design and fully relies on TradeLocker API service. 

You could regularly monitor TradeLocker API realtime status at their internal site:



If you need TradeLocker copier by Non API approach, please look for that copier package or user guide at shared link.



======


1. Install MT4 or MT5 signal transmit EA. 

Put “MT4ToTradeLocker.ex4” or “MT5ToTradeLocker.ex5” to \MQL4\Experts\ or \MQL5\Experts\ folder. 


At MT4 or MT5, “Menu” → “Tools” → “Options”, at below selection, click “Allow DLL Import” - as this EA needs network authentication for use.




Open any chart and attach this Copier EA to chart. At the first EA variable, please enter your license key






1.  Please attach this signal EA to ONLY one chart.  

This EA can fetch multiple symbol/trade event signals of this MT4/MT5.  If you want to have another copier for different TradeLocker account, you can elect to attach to another chart.


If you want to temporarily stop this EA, please click 'Stop Signals' button on the trade panel.  MT4/MT5 'auto trading' or 'algo trading' button is not applicable as this EA won't make any trade.


To force copier reconnect to broker server, just switch copier's chart timeframe to another.


TradeLocker API only accepts ONE trade entry/exit/modification per time at one account.  For concurrent trade action scenario, it will only accept the first one and discard the rest (by raising the error message of 'too many requests') 


This copier has one special feature called 'API Network Throttling?' that you can enable to add time delay on each consecutive trade action.  Default is true.  Delay time (in second) is adjustable.  If your strategy doesn't have concurrent trade entry/exit, you could set that false that will make order signals faster.


If any failed order entry or exit, please check API response messages at MT4/MT5 log window.  API response message is something like {"orderId":381975072}



2. Select Demo or Live mode


3. Below required info are what you've registered or got from your TradeLocker Brokers.  Those info are required to log in TradeLocker server api.  Please check the welcome email from your TradeLocker.


(a) email address -  that you've used to register your TradeLocker broker account

(b) password - that was assigned by your broker

(c) broker server - it should be depicted at your broker welcome or account confirmation email.


'Account Ids' field can be left as blank.  If blank, EA will request to get all available account numbers from your TradeLocker broker and then select the first one to send the copy trade signals.


If you want to specify which TradeLocker account to get copy signals, the input format is:

single account as 

34235432

multiple accounts as 

34235234,1234355 

(separated by comma)


If multiple accounts are input, EA will send out the copy signal to each of them (i.e. multiple account support).  Special note: please DO NOT put more than 3 accounts on this list.  If you need more accounts to be copied, open another chart to attach copier with different set of account list.


This EA will cross check what account number you've input with what it gets from TradeLocker broker.  If it's not consistent, EA will hold up.


4. Symbol mapping list - if TradeLocker instrument name is different with MetaTrader's, please input as below format (MT4/MT5's symbol name first, comma, then TradeLocker's, then semi-colon)

BTCUSD,BITCOIN;

if two pairs, 

BICUSD,BITCOIN;XAUUSD,GOLD;


- 'MetaTrader Symbol Prefix To Be Ignored' and 'MetaTrader Symbol Postfix To Be Ignored'

assume you input prefix en and that MT4/MT5 symbol is enEURUSD, this copier EA will remove the prefix 'en' and convert it as EURUSD before sending to TradeLocker.

assume you input postfix .st and that MT4/MT5 symbol is EURUSD.st, this copier EA will remove the postfix '.st' and convert it as EURUSD before sending to TradeLocker.


- Add Extra Symbol Postfix To TradeLocker

All symbol names will add this common postfix to TradeLocker.  For instance, if setting .PRO, EURUSD will be converted as EURUSD.PRO and GBPUSD as GBPUSD.PRO so you don't need to set one by one at 'Symbol Mapping List' variable.


5. Lot multiplier list - if you want to multiply the lot value to TradeLocker, for instance, input 

EURUSD,10;XAUUSD,2;

If simply input 

10

All trade lots at MT4/MT5 will be multiplied by 10.


6. Partial close feature is enabled by default - while TP/SL price copy is *disabled* by default.


'Copy Limit/Stop Orders' is also *disabled' by default.


'No Close Signals If That Dealt Order Has TP/SL Prices'  ---> if enabled, this feature is to refrain sending MT4/MT5 position *exit* signal to TradeLocker as TradeLocker trades already have got its own TP/SL.  Recommend to keep this false as default.


Due to market price deviation between two trading platforms, if you want to get consistent copy result, please DO NOT enable 'copy TP/SL' or 'copy Limit/Stop' feautres.


7. Lot mode - default is 'follow MT4/MT5 order lot'; another two options are 'Equity-To-Equity' and 'Fixed Lot'


8. Order magic number list - you could assign specific magic number for trade signaling. 


For multiple magic, separate each with comma.

For instance, 3413434,1343292

Default is a blank string, i.e. applying on all trades.


Special reminder:

If you put your ea's magic number and want to limit the copy to it, e.g. magic number 3421243

Then MT4/MT5 signal ea will only scan orders with magic number = 3421243

Kindy be aware MT4/MT5 manual order's magic number is 0.

If you want to have that signal ea cover BOTH manual orders and your own ea orders, it should be set like

0,3421243

i.e. include 0 at magic number list


9. Applicable symbol list - you could restrict to specific symbol/instruments.  Separate each with comma, e.g. EURUSD,XAUUSD,USOIL

Default is a blank string, i.e. applying on all symbols.


10. Applicable comment list - you could restrict to specific order comment.  Separate each with comma.


> Reverse trade - if setting true, it will reverse the trade signal to TradeLocker.  

For instance, a LONG trade will be signaled as a SHORT trade.


11. As there are great variations of customer custom needs of control or filter requirements, this copier use the alternative approach to accommodate.


If enable "Enable Hold-Up Feature?" variable (default is false), MT4/MT5 signal EA will keep checking whether MT4/MT5 global variable named 

TLCOPYDISABLE

is 1 or not.  If that equals 1, MT4/MT5 signal EA will hold up.  It doesn't equal or that global variable is not set, MT4/MT5 signal EA will keep running.


You could self write (or hire a developer) to write an EA or indicator to set value to that global variable with your own control/filter logics.


12. A special scenario regarding modifying TP or SL to zero:


When a TP or SL price is modified to zero, most forex/cfd trading platforms will treat it as a *removal* of TP/SL, e.g. MT4/MT5, cTrader, MatchTrader.


However, TradeLocker is the exception.  It will go straight to modify TP or SL to zero price.  That will cause unexpected close toward LONG order if TP set to zero (or SHORT order if SL set to zero)


A new variable called 'Don't Set Zero on TP/SL Modification' is introduced to avoid this scenario.  Default is true (i.e. don't set zero prices on TP/SL modification).  The side-effect is TP/SL cannot be set to zero any more


This feature is ONLY applicable when 'Copy TP/SL?' feature is enabled.



13As network API-based copier is inherently less reliable than local copier (due to client/broker network stability), this copier will output the API response messages to mt4/mt5 log. Once you get any trade issue in the future, you could check the log file and see how broker api server responds.



==============


Special Notes for DxTrade/TradeLocker 'Network Throttling' restriction


As many customers are concerning the impact of DxTrade/TradeLocker 'network throttling' restriction towards their strategy or multiple account copy, I elaborate again how this restriction works and how this copier accommodates this restriction:


- What is 'Network Throttling'? 


You could google this term.  It's intentionally imposed by server provider to limit the client network concurrent multiple requests.  If it's implemented by trading API providers, that means that brokers won't like your concurrent multiple trading requests to make their trading server too overloaded.


- What are implemented by DxTrade & TradeLocker?


DxTrade has explicitly stated their network throttling rules at their API doc:

https://demo.dx.trade/developers/#/DXtrade-REST-API

(see 'rate limits & throttling' section)

TradeLocker doesn't mention that at their API doc but from recent experiments it shows similar behavior (but a bit relaxed than DxTrade).  For concurrent multiple trading requests, TradeLocker API will reject some by responding 'too frequent requests'.


DxTrade network throttling rules have applied on login, date fetch, trading request, etc.  If we look at the trading request rule:

For trading requests(placing / modifying / canceling orders) based on client session, default value 1 per second.

That means if you send the concurrent 3 consecutive trade entry or exit or modification requests to DxTrade API, it will only take the first trading request but reject the rest by responding 'too many requests' - as those concurrent multiple trading requests are made WITHIN one second.


Please note multiple account copy also leads to concurrent multiple trading requests scenario - as copier has to send another account trading activities concurrently.



- How this copier accommodates DxTrade/TradeLooker 'Network Throttling' restriction?


All API response messages will be output at MT4/MT5 log window (no matter success or failure).  If you get any missed order entry or exit at DxTrade/TradeLooker side, please check MT4/MT5 log first for API failure response.


As we are unable to change DxTrade/TradeLooker restriction behavior, this copier provides below variables so you could set or adjust (at the bottom of copier variable window):


(a) 'API Network Throttling?' - default is 'true', i.e. enabled.  This copier will follow their API throttling rule.


(b) 'Throttling Delay in Second'Default value is 1, i.e. one second.  If above variable is set 'false', this variable is not applicable.  


You could first try to set 'API Network Throttling?' as 'false' (i.e. disabled).  This copier will instantly send out all concurrent trading entry/exit/modification to API server.  


You can do this as experiment.  Just quickly repeatedly click MT4/MT5 one-click panel to generate concurrent multiple order entries (or make concurrent multiple order exits).  Then check MT4/MT5 log window how API response messages say.  If you're confident that DxTrade/TradeLooker don't strictly execute their throttling rule or your strategy won't have concurrent trade entry/exit scenario, you could set this variable 'false' as disabled.


As this 'API Network Throttling?' is set 'true' as default, for a concurrent trade entrie (e.g. three entries), this copier will do the following actions sequentially

- send the first trade entry request to API, and queue the rest of two

- wait 1-2 second (depending on the throttling delay time you've set + a little time margin)

- send the second trade entry request

- wait 1-2 second

- send the third trade entry request

Please note the whole process cannot exceed 30 seconds



Suggestions: 

(a) Review your strategy behavior if timing delay really matters.

(b) Talk to your brokers if they are unable to remove network throttling rule especially for your account (but I am not so sure they are willing to do this exceptionally)







Popular posts from this blog

FREE EVALUATION WITH LIMITED SYMBOLS

TRADE COPIER USER GUIDE LIST

METATRADER TO NINJATRADER TRADE COPIER