Slave install:
Close Metatrader
Execute SCM+HR_Slave_Setup.exe
Enter path to your Metatrader installation directory.
Example: If your Metatrader installation directory is “C:\Metatrader4” browse to this folder in dialog window of installer.
Run Metatrader and attach expert to ONE chart. Is not important what symbol or time frame. However, is recommended to choose a volatile pair to have greater number of ticks.
Slave will execute all trades sent by master no matter what pairs are these trades and no matter on what chart is Slave attached.
For both Master and Slaves:
• additional required files will be installed automatically.
• will be created an uninstaller on root directory of Metatrader and a shortcut on Programs menu. Make sure Common tab is set like this:
Never attach master or slave expert on more than one chart on same account!
FUNCTIONS DESCRIPTION
Execution mode
• On Tick: Expert will run on ticks.
• On Timer: Expert will run at regular intervals defined at TimerInterval
• Combined: Expert will run on ticks and on timer.
• TimerInterval: Interval in miliseconds for On Timer mode
MySQL server settings
• Host: MySQL server address. Can be either name of server (www.mysqlserver.com) or server IP (12.24.234.127)
• Port: Port used to connect to MySQL server (default 3306)
• User: user name to connect to MySQL server
• Password: password required for above user
• Database: database name to connect to
• UseSSL: To use this option mysql server must have SSL enabled and you have client certificates to place them on metatrader/config folder. Also mysql user must be configured accordingly.
Trading setup
• ID: ID of this slave as generated on control panel.
• Place.BUY.Orders: Is is set to true will execute BUY orders, if is set to false will not execute BUY orders.
• Place.SELL.Orders: Is is set to true will execute SELL orders, if is set to false will not execute SELL orders.
• PlacePendingOrders: Is is set to true will execute pending orders, if is set to false will not execute pending orders
• ConvertToPending: If true orders outside pips tolerance will be converted to pending orders.
• AllowReopen: If Slave closed manually a order and AllowReopen = true then that order will executed again as soon price is in range specified at PipsTolerance (if is a market order).
• CloseOrders If is set to false orders will not be closed when master closed them and you have to close them manually.
• ReverseTrades: If is set to true will reverse orders as following: BUY orders will be executed as SELL
SELL orders will be executed as BUY
SELL Stop orders will be executed as BUY Limit SELL Limit orders will be executed as BUY Stop BUY Stop orders will be executed as SELL Limit BUY Limit orders will be executed as SELL Stop
Stop loss and take profit will be swapped.
• SwapAskBidOnReverse: If true will open reversed buy orders (executed as sell) on bid instead ask and reversed sell orders (executed as buy) on ask instead bid.
• AllowPartialClose If is set to true will execute partial close as master do. If is set to false, will close order when master will close last remaining of original order.
Note: If CalculateLotsMode=Fixed lot partial closing will not be executed, order will be closed when master will close last remaining of original order.
• MaxPairOrders: No trades will be executed if slave account have more open orders for any given pair than MaxPairOrders value
• MaxOpenOrders: No trades will be executed if slave account have more open orders than MaxOpenOrders value
• MaxDrawDownPercent: No trades will be executed if slave's account drawdown is higher that specified value.
Drawdown formula:( Account Equity – Account Balance) / Account Balance * 100.
• Slippage: Maximum slippage you allow for opening and closing of orders. Slippage is calculated as 4 digit pip value. If your broker use 5 digits it mean Slippage will be converted from 3 to 30 automatically.
• Use MasterComments: if true trade comment will be same as master's trade
• TradeComment: Allow user to set a custom comment for trades if UseMasterComments=false.
PipsTolerance
PipsTolerance: PipsTolerance is maximum difference you accept between current price of your broker and price sent by Master for a given symbol.
When difference is in favor of order profit we call this Positive Tolerance. When difference is against order profit we call this Negative Tolerance. Example:
If current price is 1.3520 and order price is 1.3525 and order is BUY then is called Negative Pips Tolerance.
If order is SELL then is called Positive Pips Tolerance
• EnterOnNegativeTolerance: If is set to true market order will be executed on range specified by Min and Max negative pips tolerance. If is set to false market order will not be executed on negative tolerance no matter Min and Max values.
• MinNegativePipsTolerance: If MinNegativePipsTolerance = 2 it mean -2 pips deviation of current price versus price sent by Master.
• MaxNegativePipsTolerance: If MaxNegativePipsTolerance = 5 it mean -5 pips deviation of current price versus price sent by Master.
• EnterOnPositiveTolerance: If is set to true market order will be executed on range specified by Min and Max positive pips tolerance. If is set to false market order will not be executed on positive tolerance no matter Min and Max values.
• MinPositivePipsTolerance: If MinPositivePipsTolerance = 2 it mean +2 pips deviation of current price versus price sent by Master.
• MaxPositivePipsTolerance: If MaxPositivePipsTolerance = 5 it mean +5 pips deviation of current price versus price sent by Master.
Pips Tolerances are calculated as 4 digit pip value.
• If your broker use 5 digits it mean Pips Tolerances will be converted from 5 to 50 automatically.
Stop loss and take profit
• CalculateFromMasterPrice: If true SL and TP will be calculated from price sent by master, if false SL and TP will be calculated from actual order open price.
• TP_Scaling: Take profit modifier, 1 mean 100% and TP will be same as on master.
0.5 mean 50% from TP of master, 1.5 mean 150% and so on.
• SL_Scaling: Stop loss modifier, 1 mean 100% and SL will be same as on master.
0.5 mean 50% from SL of master, 1.5 mean 150% and so on.
• Custom_SL_TP : if is set to true will ignore stop loss and take profit sent by master
• Custom_SL: Set desired stop loss in pips. Use value as for 4 digits broker. If you want 50 pips SL, enter 50. For 5 digits broker will be calculated as 500 pips.
• Custom_TP: Set desired take profit in pips. Use value as for 4 digits broker. If you want 50 pips TP, enter 50. For 5 digits broker will be calculated as 500 pips.
Important: Custom SL and TP are placed once, when order is executed and will not be modified further. You must change them manually if you want different values.
Lot size management
• CalculateLotsMode: 1=RiskScaling, 2=LotScaling 3=CustomLotSizee, 4=percent from balance
• RiskScaling:Use to adjust risk according to risk used by master for a trade.
If master balance is 10.000 and lot size is 0.10, a slave with balance = 5.000 and RiskScaling=1 will open trade with lot=0.05. Adjust RiskScaling to take more risk(like RiskScaling=1.5 to risk 50% more than master) or less risk (like RiskScaling=0.5 to take half risk as master)
• LotScaling: Used to adjust lot size to match Slave account size. If master trade 0.10 lots and have account size = 5.000$ and Slave have account size = 10.000$ then use. LotScaling=2. All orders will be executed with doubled lot size.
If slave have account size=2.500$ then use LotScaling=0.5. All trades will be executed with half of Master lot sizes.
• MaximumRisk:Used with CalculateLotsMode = 4, in percents.
• CustomLotSize Size of your custom lots (Fixed lot size).
Important: Experts will convert lot sizes but will obey Slave broker settings. If value of new lot size is less than broker accept will be set as minimum lot size. Even if is used no lot size conversion lot size will respect broker's settings. For example if Master send orders with lot size = 0.05 and Slave broker accept minimum lot size = 0.10 then order will be executed with lot size = 0.10. Master should provide such information to it's slaves. For no conversion use LotScaling = 1.0.
Filters
• SymbolsFilterMode: deny or allow
• SymbolsFilter deny mode: Symbols names specified here will not be executed. Can be used if Slave's user don't want to trade a specific symbol or if Salve's broker do not have that symbol.
• SymbolsFilter allow mode: Only symbols names specified here will be executed. Can be used if Slave's user want to trade specific symbols only.
Separate entries by a comma.
• MagicFilterMode: deny or allow
• MagicFilter deny mode: Orders that have magic numbers specified here will not be executed.
• MagicFilter allow mode: Only orders that have magic numbers specified here will be executed. Separate entries by a comma.
To filter orders without magic number enter “none”.
• CommentFilterMode: deny or allow
• StrictCommentFilter: If true will match if search pattern is equal to order comment. If false will match if search pattern is found in order comment.
Example:
Order comment = “ExpertComment_EURUSD_60”. Comment filter: “ExpertComment”.
If StrictCommentFilter is true will not match, if false will match.
• CommentFilter deny mode: Orders that have comments specified here will not be executed.
• CommentFilter allow mode: Only orders that have comments specified here will be executed. Separate entries by a comma.
To filter orders without comment enter “none”.
• MaxOrderAge: Maximum age of Master orders in minutes. If you open Metatrader after Master executed some orders, or you had problem like Internet connection failure and Master opened some orders in this interval, any orders older that MaxOrderAge won't be executed on Salve side. (Market orders will be executed only if current price is in range specified at PipsTolerance). To disable this option input 0.
Symbols name
• AutomaticSymbolsRename: If true will scan for prefix and suffix at EA init.
If a suffix or prefix is found will be added to incoming orders only if SymbolPrefix/SymbolSuffix are empty. If SymbolPrefix/SymbolSuffix are not empty will be used defined values.
If AutomaticSymbolsRename is false EA will use symbols names as master send them. If SymbolPrefix/SymbolSuffix are not empty those values will be added to symbol name.
• SymbolPrefix: Leave blank for automatic detection (AutomaticSymbolsRename must be true).
• SymbolSuffix: Leave blank for automatic detection (AutomaticSymbolsRename must be true). If Slave's broker use more custom suffixes (like EURUSD., EURUSDi, EURUSD_) then input here desired value. If is not entered a value will be used first found suffix.
– CustomSymbolRename: if is set to “true” then incoming symbol name defined on SymbolNameToFind will converted to symbol name defined on SymbolRenameWith
SymbolNameToFind and SymbolRenameWith are defined as arrays. Both must have same number of elements and minimum length for both is 3 characters.
Separate each element by a comma, and make sure there are no spaces. Like this: “XAUUSD,XAGUSD” (without quotes)..
Matching names must take same position on arrays.
Example: You want to replace “XAUUSD” with “GOLD” and “XAGUSD” with “SILVER” Inputs should look like this:
SymbolNameToFind = XAUUSD,XAGUSD” (without quotes). SymbolRenameWith = “GOLD,SILVER”(without quotes).
“XAUUSD” is first element of array SymbolNameToFind and will be replaced with first element of array SymbolRenameWith which is “GOLD”
“XAGUSD” is second element of array SymbolNameToFind and will be replaced with second element of array SymbolRenameWith which is “SILVER”.
If symbol name is not found will be returned unchanged.
Do not forget, all symbols names are case sensitive and must be used as they appear. “EURUSD” is not equal to “eurusd”.
Alerts
• AlertOpenOrder: Slave EA will alert by playing a sound and pop up a window when a orders is open.
• AlertModifyOrder: Slave EA will alert by playing a sound and pop up a window when a orders is modified .
• AlertCloseOrder: Slave EA will alert by playing a sound and pop up a window when a orders is closed.
• AlertOnError: If true, an alert on errors will display. If false, alert will be written in experts log only.
Sounds
• PlaySounds: Enable or disable sounds.
• SoundOpenOrder: This sound will be played when a new order is open.
• SoundModifyOrder: This sound will be played when a order is modified.
• SoundCloseOrder: This sound will be played when a order is Closed.
To use custom sounds you have to place wav files in sounds directory of Metatrader4.
E-mail options
• MailOpenOrder: Slave EA will send an e-mail when a orders is open.
• MailModifyOrder: Slave EA will send an e-mail when a orders is modified
• MailCloseOrder: Slave EA will send an e-mail when a orders is closed.
– MailSubject: Subject you want for sent mails.
E-mail address should be set on Metatrader.
Go to Tools->Options (or press CTRL+O) and select “Email' tab. Input there required information and click “Enable”.
Time stamp on e-mails body is user's system time.
List of master's orders
• ShowMasterList: Will display on chart a list of orders currently open on Master.
• MasterListColor: Set color for Master list.
• Font size: Set desired font size
• Halign: Horizontal align
• Valign: Horizontal align
Logs and warnings
– WriteLog: Expert will create a own log as a .csv file. This file is named on form”YYYY.MM.DD_SignalCopyMySQL_xxxxx.csv” where xxxxx is slave account number. File content look like this: DateTime,Action,Symbol,Type,Ticket,Lots,OpenPrice,StopLoss,TakeProfit,Diff-Err-PL
Sample:
2009.07.28 08:10:41,Open,GBPUSD,SELL,59561934,0.01,1.6546,1.7147,1.6297,0.4
This mean an SELL order for GBPUSD was opened at 2009.07.28 08:10:41 at price 1.6546 with 0.01 lots, have ticket number 59561934 and have a pip deviation of 0.4 pips. (considering pips are calculated as 4 digit pair) so for 5 digits this mean 4 pips.
Another example:
2009.07.28 15:56:06,Close Error,EURJPY,BUY,59677200,0.01,134.426,128.424,136.924,146
There was an error on order close. See number on last column, is error code. In this case is 146 which mean “Trade context busy”.
Column names are self-explanatory, last one, Diff-Err-PL mean: Diff: pips deviation for open orders, Err mean error code for errors logged, PL mean Profit / loss for closed orders. A new file is created on every day (if any event occur) and can be open directly in Excel (useful to make reports, compare trades).
Beginning of a new day is considered according to broker time, not user time.
• DisplayWarnings: Print on chart warnings related to Filters, MaxOrdersAge, and info for orders outside range of PipsTolerance.
• PrintWarnings: Write on experts log warnings related to Filters, MaxOrdersAge, and info for orders outside range of PipsTolerance.
• PrintInfo: If true will display additional information.(Connecting, retrieving orders, etc)
• ShowTradeContextBusy:If true will print TradeContextBusy message. Useful to know if
slave EA was postponed due to other EA running at that moment.
Market Status
– EnableMarketStatus: If is true market status will be detected and expert will be stooped during weekends to avoid unnecessary connects to MySQL server, rescanning broker's servers and unnecessary emulation of ticks.
• GMT_Open_Hour: GMT hour on Saturdays when your broker is open for trading.
• GMT_Close_Hour: GMT hour on Fridays when your broker is closed for trading.
• Note:
• Default times are Friday 22 GMT for market closing and Sunday 22 GMT from opening.
• Open hour and close hour vary from broker to broker. For example, Alpari UK start on Friday 22 GMT and close on Sunday 21 GMT.
• Market Status detect only weekends, not other non-trading days as holidays.
Connection to broker
• AlternateCheckMethod: If false default IsConnected() method is used. If true, will be used alternative method.
• BrokerConnectionTimeout: timeout in seconds after which the connection to broker is lost. Set to 0 to disable connection check. Works only if AlternateCheckMethod=true.
• RescanServersTimeout: works only if AlternateCheckMethod=true. The EA will rescan broker server if timeout is higher than a specified value. Set to 0 to disable. This works only with BrokerConnectionTimeout > 0 if AlternateCheckMethod=true. Once triggered, EA will rescan servers every 30 seconds until connection is restored.