Trading Router
Contact Us Log in Sign up

MT4/5 TradingRouter EA Settings

Trading Router Client Token



Trading Router Client Tokenis an identifer of your account.

You can find your client token on the dashboard of trading router website. You must input client token to connect to server. Client token is a string starting with "client".



Syntax Settings

Syntax works together with parameters in message



Stop Loss Synatx



Stop loss syntax determine the stop loss. It has 3 inputs: "SL Source", "Stop Loss (sl=)", and "SL Type (sl=)"


"SL Source" input has two options: "Set stop loss by message" and "Set stop loss by EA, from the input below"

If you choose "Set stop loss by message", the stop loss will be determined by the Stop Loss Parameter in message. Please refer to Stop Loss Parameter on Syntax page

If you choose "Set stop loss by EA, from the input below", the stop loss is determined by "Stop Loss (sl=)" input, and the stop loss type is determined by "SL type (sl=)" inputs. You don't need Stop Loss Parameter in message, any Stop Loss Parameter in message will be ignored.

Set stop loss by EA exmaple 1

The stop loss is 10 pips away from open price.

  • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, risk_lots=0.1 (note: stop loss is 10 pips above open price)
  • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, risk_lots=0.1, sl_pips=20 (note: stop loss is still 10 pips above open price, the sl_pips= in message is ignored)


Set stop loss by EA exmaple 2

The stop loss is 2 percentage away from open price.

  • token=master19dd529542d4b79d2bc4, signal=buy, symbol=AUDUSD, risk_lots=0.1 (note: stop loss is 2% below open price)
  • token=master19dd529542d4b79d2bc4, signal=buy, symbol=AUDUSD, risk_lots=0.1, sl_pips=50 (note: stop loss is still 2% below open price, the sl_pips= in message is ingored)


Set stop loss by EA exmaple 3

The stop loss is the exact price $970.

  • token=master19dd529542d4b79d2bc4, signal=buy, symbol=BTCUSD, risk_lots=0.1 (note: stop loss is $970)

This setting is not recommended, because the stop loss for all you order is placed at $970, it may not be a valid stop loss for all symbols. For example, if you buy BTCUSD, $970 may be a valid stop loss, but if you sell BTCUSD, $970 may be a invalid stop loss. And also if you buy EURUSD, $970 may not be a valid stop loss.



Take Profit Synatx



Take profit syntax determine the take profit. It has 3 inputs: "TP Source", "Take Profit (tp=)", and "TP Type (tp=)"


"TP Source" input has two options: "Set take profit by message" and "Set take profit by EA, from the input below"

If you choose "Set take profit by message", the take profit will be determined by the Take Profit Parameter in message. Please refer to Take Profit Parameter on Syntax page

If you choose "Set take profit by EA, from the input below", the take profit is determined by "Take Profit (tp=)" input, and the take profit type is determined by "TP Type (tp=)" inputs. You don't need Take Profit Parameter in message, any Take Profit Parameter in message will be ignored.

Set take profit by EA exmaple 1

The take profit is 10 pips away from open price.

  • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, risk_lots=0.1 (note: take profit is 10 pips below open price)
  • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, risk_lots=0.1, tp_pips=20 (note: take profit is still 10 pips below open price, the tp_pips= in message is ignored)


Set take profit by EA exmaple 2

The take profit is 2 percentage away from open price.

  • token=master19dd529542d4b79d2bc4, signal=buy, symbol=AUDUSD, risk_lots=0.1 (note: take profit is 2% above open price)
  • token=master19dd529542d4b79d2bc4, signal=buy, symbol=AUDUSD, risk_lots=0.1, tp_pips=50 (note: take profit is still 2% above open price, the tp_pips= in message is ingored)


Set take profit by EA exmaple 3

The take profit is the exact price $1000.

  • token=master19dd529542d4b79d2bc4, signal=buy, symbol=BTCUSD, risk_lots=0.1 (note: take profit is $1000)

This setting is not recommended, because the take profit for all you order is placed at $1000, it may not be a valid take profit for all symbols. For example, if you buy BTCUSD, $1000 may be a valid take profit , but if you sell BTCUSD, $1000 may be a invalid take profit . And also if you buy EURUSD, $1000 may not be a valid take profit.



Risk Synatx



Risk syntax determine the volume. It has 3 inputs: "Risk Source", "Risk (risk=)", and "Risk Type (risk=)"


"Risk Source" input has two options: "Set risk by message" and "Set risk by EA, from the input below"

If you choose "Set risk by message", the volume will be determined by the Risk Parameter in message. Please refer to Risk Parameter on Syntax page

If you choose "Set risk by EA, from the input below", the volume is determined by "Risk (risk=)" input, and the risk type is determined by "Risk Type (risk=)" inputs. You don't need Risk Parameter in message, any Risk Parameter in message will be ignored.

Set risk by EA exmaple 1

The volume is 0.1 lots.

  • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD (note: create 0.1 lot of sell position for EURUSD)
  • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, risk_cncy_amt=200 (note: still create 0.1 lot of sell position for EURUSD, the risk_cncy_amt in message is ignored )


  • Set risk by EA exmaple 2

    200 amount of currency that you will lose if your trade hits the SL. If you account's currency is USD, then you will lose $200 when the trade hits SL.

    You must set stop loss either by Stop Loss Parameter in message, or by Set Stop Loss in EA, because the volume of the order is calculated according to stop loss.

    • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, sl_pips=100 (note: stop loss is 100 pips from open price. The volume is calculated by stop loss so that when the trade hits the stop loss, the trade will lose 200 amount of currency. If your base currency is USD, then $200 will be lost when the trade hits stop loss.)
    • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, sl_pips=100, risk_cncy_amt=150, (note: stop loss is 100 pips from open price. The volume is calculated by stop loss so that when the trade hits the stop loss, the trade will still lose 200 amount of currency. If your base currency is USD, then $200 will be lost when the trade hits stop loss. the risk_cncy_amt= parameter in message is ignored. )


    Set risk by EA exmaple 3

    0.5% amount of currency that you will lose if your trade hits the SL.

    You must set stop loss either by Stop Loss Parameter in message, or by Set Stop Loss in EA, because the volume of the order is calculated according to stop loss.

    • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, sl_pips=100 (note: stop loss is 100 pips from open price. The volume is calculated by stop loss so that when the trade hits the stop loss, the trade will lose 0.5% of your balance.)
    • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD, risk_pct_bal_loss=0.8, , sl_pips=100 (note: stop loss is 100 pips from open price. The volume is calculated by stop loss so that when the trade hits the stop loss, the trade will still lose 0.5% of your balance. The risk_pct_bal_loss= parameter in message is ignored )


    Set risk by EA exmaple 4

    The trade will increase 0.5% of the margin.

    • token=master19dd529542d4b79d2bc4, signal=sell, symbol=EURUSD (note: If your balance is $10000, the 0.5% of your balance is $50. The volume is calculated so that the trade will increase your margin by $50. )




    Pending Order Entry Price Type (price=)

    Define the type of price= parameter in message. If your message does not have price=, or the price= is ingored in your message, this setting will have no effect

    Refer price= on Syntax page


    Pending Order Entry Price Type (price=) example

    • token=master19dd529542d4b79d2bc4, signal=buylimit, symbol=EURUSD, price=300, risk_lots=0.1 (note: create a buylimit order for 0.1 lot of EURUSD, the entry price is 300 below current market price )
    • token=master19dd529542d4b79d2bc4, signal=buystop, symbol=EURUSD, price_pips=500, risk_lots=0.2 (note: create a buystop order for 0.2 lot of EURUSD, the entry price is 500 above current market price, there is no price= so the "Pending Order Entry Price Type (price=)" setting does not have effect)
    • token=master19dd529542d4b79d2bc4, signal=buystop, symbol=EURUSD, price=300, price_pips=500, risk_lots=0.2 (note: create a buystop order for 0.2 lot of EURUSD, the entry price is 500 above current market price, the price= is ignored before price_pips= has higher priority and price_pips=500 is used)


    Account Filter Type (accfilter=)

    Define the type of accfilter= parameter in message. If your message does not have accfilter=, or the accfilter= is ingored in your message, this setting will have no effect

    Refer accfilter= on Syntax page


    Account Filter Type (accfilter=) example

    • token=master19dd529542d4b79d2bc4, signal=buy, symbol=EURUSD, risk_lots=0.1 , accfilter=5234.5 (note: create a long position for 0.1 lot of EURUSD if your current account balance is greater then 5234.5 )
    • token=master19dd529542d4b79d2bc4, signal=buy, symbol=EURUSD, risk_lots=0.1 , accfilter_bal = 6000, accfilter=5234.5 (note: create a long position for 0.1 lot of EURUSD if your current account balance is greater then 6000. the accfilter=5234.5 is not used because accfilter_bal= has higher priority. )


    General Settings



    Pyramiding

    Determine how multiple trades are handled.

    this setting only works for market order.

    It has four options: "All incoming trades will open without restrictions", "If symbol & direction in profit", "Either 1 Buy Or 1 Sell", "Only 1 Buy And 1 Sell"

    If you choose "All incoming trades will open without restrictions", there is no restriction, all incomding market buy/sell trades will be handled

    If you choose "If symbol & direction in profit", an incoming market buy/sell trade will be handled only if the all the orders with the same symbol and direction have a positive net profit. For example, an incoming buy EURUSD order will only be created if the sum of all long EURUSD positions has a profit of more than 0.

    If you choose "Either 1 Buy Or 1 Sell", there will be at most one open trade for a symbol at any time. For example, if there is already one open EURUSD long position, then any buy or sell EURUSD market order will not be handled. If there is alrady one open EURUSD short position, then any buy or sell EURUSD market order will not be handled.

    If you choose "Only 1 Buy And 1 Sell", there will be at most one long position and one short position for a symbol at any time For example, if there is already one open EURUSD long position but no open EURUSD short position, then any incoming buy EURUSD market order will not be handled, but the next incoming sell EURUSD market order can be handled.



    Close on Reverse

    Determines the treatment of opposite signals.

    This setting only works for buy/sell market order

    It has three options: "On -- Hedging", "On -- Netting", "Off -- No Close on reverse"


    If you choose "On -- Hedging", an incoming order will close all the opposite positions for the same symbol before make the incomding order. For example, if you send a buy 0.1 lot EURUSD message, all short EURUSD positions will be closed, then 0.1 lot of long EURUSD position will be created.

    If you choose "On -- Netting", an incomding order will close the same volume of opposite positions for the same symbol. If the incoming order's volume is more than all opposite positions, then the incoming order will create a position with remaining volume, otherwise no new position will be made. For example, if there are already 3 short EURUSD positions and the total volume is 0.9 lots. When a buy 1.2 lots EURUSD order comes, all the short 0.9 lots EURUSD will be close, and 0.3 lots long EURUSD will be created, because 1.2 - 0.9 = 0.3. Another example, if there are already 3 short EURUSD positions and the total volume is 0.9 lots. When a buy 0.8 lots EURUSD order comes, then 0.8 lots short EURUSD will be closed and 0.1 lot short EURUSD position will remain, and no new long position is created.

    If you choose "Off -- No Close on reverse", then an incoming order will not affect any existing positoins



    Shadow Targets

    Apply additional take profit and stop loss

    This setting works for both market order and pending order

    This setting only affect the initial stop loss and take profit of orders or positions, it does not affect SL Trailing Feature and Breakeven Feature

    It has two options: "On ", "Off"


    If you choose "On", additional 100 pips stop loss and take profit will be applied to the order.

    Shadow Target On Exmaple

    • token=master19dd529542d4b79d2bc4, signal=buy, symbol=EURUSD, risk_lots=0.1 , sl_pips=20, tp_pips=30 (note: create a long position for 0.1 lot of EURUSD, the stop loss in message is 20 pips, and additional 100 pips stop loss is added, so the stop loss of the position is 120. The take profit in message is 30 pips, and additional 100 pips take profit is added, so the take profit is 130.)

    If you choose "Off", no additional stop loss and take profit will be applied





    Slippage

    The default slippage for market orders.

    This settings only works on buy/sell market order

    If there is no slippage= parameter in message, the default slippage in this setting will be used.

    If there is slippage= parameter in message, this setting will be ignored



    • token=master19dd529542d4b79d2bc4, signal=buy, symbol=EURUSD, risk_lots=0.1 (note: create a long position for 0.1 lot of EURUSD, the slippage is 1000)
    • token=master19dd529542d4b79d2bc4, signal=buy, symbol=EURUSD, risk_lots=0.1, slippage=150 (note: create a long position for 0.1 lot of EURUSD, the slippage is 150. Because there is slippage= parameter in message, the slippage setting in EA will be ignored.)


    Risk Management Settings




    Partial Close Percentage

    This setting is used by closelongpct and closeshortpct command

    You can set Partial Close Percentage to any value less than 100, then whenever closelongpct or closeshortpct comes, that percentage of initial volume will be closed


    Partial Close Percentage example
    set Partial Close Percentage to 30, whenever closelongpct comes, 30% of initial volume will be closed.

    • token=master19dd529542d4b79d2bc4,signal=buy, symbol=EURUSD, risk_lots=1 (note: 1 lot of EURUSD long position is created. Initial volume is 1 lot.)
    • token=master19dd529542d4b79d2bc4,signal=closelongpct, symbol=EURUSD (note: 0.3 lot of EURUSD long position is closed )
    • token=master19dd529542d4b79d2bc4,signal=closelongpct, symbol=EURUSD (note: 0.3 lot of EURUSD long position is closed )
    • token=master19dd529542d4b79d2bc4,signal=closelongpct, symbol=EURUSD (note: 0.3 lot of EURUSD long position is closed )
    • token=master19dd529542d4b79d2bc4,signal=closelongpct, symbol=EURUSD (note: final 0.1 lot of EURUSD long position is closed )


    Max Open Positions

    The max positions TradingRouter EA can make

    This setting only works for buy/sell market order

    If Max Open Positions is 0, then there is no limit for how many positions can be created.

    If Magic Restriction is On, this setting only considers the positions opened by this EA

    If Mgaic Restriction is Off, this setting considers all positions including positions created by other EAs or created manually


    Max Open Positions example 1

    If you set Max Open Positions to 10 and Mgaic Restriction is Off

    There are already 9 open positions made by this EA, and 2 positions made manually.

    An incoming buy market order will not be processed because there are already 11 open positions


    Max Open Positions example 2

    If you set Max Open Positions to 10 and Mgaic Restriction is On

    There are already 9 open positions made by this EA, and 2 positions made manually.

    An incoming buy market order can be processed because there are only 9 open positions created by this EA.



    Max Open Positions Per Symbol

    The max positions for any symbol TradingRouter EA can make

    This setting only works for buy/sell market order

    If Max Open Positions Per Symbol is 0, then there is no limit for how many positions for any symbol can be created.

    If Magic Restriction is On, this setting only considers the positions opened by this EA

    If Mgaic Restriction is Off, this setting considers all positions including positions created by other EAs or created manually


    Max Open Positions Per Symbol example 1

    If you set Max Open Positions Per Symbol to 10 and Mgaic Restriction is Off

    There are already 9 open EURUSD positions made by this EA, and 2 open EURUSD positions made manually.

    An incoming buy EURUSD market order will not be processed because there are already 11 open EURUSD positions


    Max Open Positions Per Symbol example 2

    If you set Max Open Positions Per Symbol to 10 and Mgaic Restriction is On

    There are already 9 open EURUSD positions made by this EA, and 2 open EURUSD positions made manually.

    An incoming buy EURUSD market order can be processed because there are only 9 open EURUSD positions created by this EA.



    Daily Profit Management



    Daily Profit Management set a goal for daily profit. When the goal is achieved, actions will be taken. The actions include close all positions, halt the EA for some time.When the EA is at halt, you can use eaon command to reactivate the EA.

    Daily Profit Management has 7 inputs: "Daily Profit", "Daily Profit Type", "Daily Profit Action", "Daily Profit Halt EA Hours", "Daily Profit Halt EA Minutes", "Daily Profit/Loss Check Time (Broker Time)", and "Check Equity at Start for Daily Profit/Loss"

    If "Daily Profit" is 0, then there is no goal for daily profit.

    If "Daily Profit Type" is Percentage, the value of Daily Profit means percentage and profit is defined by percentage of the initial equity of every day.

    If "Daily Profit Type" is Currency, the value of Daily Profit means amount of currency and profit is defined by currency of the initial equity of every day.

    There are three options for action when daily profit goal is reached, "Halt EA", "Close All Positions", and "Close All Positions and Halt EA". If you choose "Halt EA" or "Close All Positions and Halt EA", the "Daily Profit Halt EA Hours" and "Daily Profit Halt EA Minutes" defines how long the EA will be halted. When the EA is at halt, you can use eaon command to reactivate the EA.

    "Daily Profit/Loss Check Time (Broker Time)" define the time when we recalcuate the equity.

    If "Check Equity at Start for Daily Profit/Loss" is On, we check the equity at the start of EA, then we check the equity at "Daily Profit/Loss Check Time" every day.

    If "Check Equity at Start for Daily Profit/Loss" is Off, we don't check the equity at the start of EA, we only check the equity at "Daily Profit/Loss Check Time" every day.


    Daily Profit Management example 1

    We check equity when starting the EA, then check equity at 09:00 (broker time) every day.

    Every time when we check the equity, we record it as the benchmark. Then if the profit is $200 more than the benchmark before next check, we halt EA for 24 hours


    Daily Profit Management example 1

    We don't check equity when starting the EA. We check equity at 20:00 (broker time) every day.

    Every time when we check the equity, we record it as the benchmark. Then if the profit is 10% more than the benchmark before next check, we close all positions and halt EA for 12 hours and 30 minutes

    If Magic Restriction is On, only positions created by this EA will be closed. If Magic Restriction is Off, all positions will be closed


    Daily Loss Management



    Daily Loss Management is similar as Daily Profit Management, it takes actions when daily loss goal is reached. It shares "Daily Profit/Loss Check Time (Broker Time) and "Check Equity at Start for Daily Profit/Loss" with Daily Profit Management.



    Cumulative Profit Management



    Cumulative Profit Management set a goal for the total profit your account has earned since the start of TradingRouter EA. When the goal is achieved, actions will be taken. The actions include close all positions, halt the EA for a day, halt the EA for a specific time, and halt the EA forever. When the EA is at halt, you can use eaon command to reactivate the EA.

    Cumulative Profit Management has 5 inputs: "Cumulative Profit (0 means off)", "Cumulative Profit Type", "Cumulative Profit Action", "Cumulative Profit Halt EA Hours", and "Cumulative Profit Halt EA Minutes"

    If "Cumulative Profit (0 means off)" is 0, then there is no goal for cumulative profit

    If "Cumulative Profit Type" is Percentage, the value of "Cumulative Profit" means percentage and profit is defined by percentage of the initial equity when EA starts

    If "Cumulative Profit Type" is Currency, the value of "Cumulative Profit" means amount of currency and profit is defined by currency of the initial equity when EA starts

    There are 7 options for action when cumulative profit goal is reached, "Halt EA (Day)", "Halt EA (Specify Time)", "Halt EA (Persistent)", "Close All Positons", "Close All Positons and Halt EA (Day)", "Close All Positons and Halt EA (Specify Time)" and "Close All Positons and Halt EA (Persistent)"



    If you choose "Halt EA (Day)" or "Close All Positons and Halt EA (Day)" the EA will be halted for 24 hours after the cumulative profit is reached

    If you choose "Halt EA (Specify Time)" or "Close All Positons and Halt EA (Specify Time)" the EA will be halted for the period specified by "Cumulative Profit Halt EA Hours" and "Cumulative Profit Halt EA Minutes" after the cumulative profit is reached

    If you choose "Halt EA (Persistent)" or "Close All Positons and Halt EA (Persistent)", the EA will be halted for ever after the cumulative profit is reached

    In any case, you can reactivate the EA by eaon command.

    When the EA is reactivated either by eaon or due to the halt timeout, the initial equity for cumulative profit/loss will be reset to the equity at the time of reactivated. And the benchmark equity for daily profit/loss will be reset to the equity at the time of reactivated if "Check Equity at Start for Daily Profit/Loss" is On


    Cumulative Profit Management example 1

    When your cumulative profit is $200, the EA will halt for 24 hours


    Cumulative Profit Management example 2

    When your cumulative profit is 10% more than the initial equity, the EA will halt for 24 hours


    Cumulative Profit Management example 3

    When your cumulative profit is 10% more than the initial equity, the EA will halt for 3 hours and 40 minutes


    Cumulative Profit Management example 4

    When your cumulative profit is 10% more than the initial equity, the EA will halt forever. It can be reactivated by eaon command


    Cumulative Profit Management example 5

    When your cumulative profit is 10% more than the initial equity, all positions will be closed and the EA will halt for 24 hours



    Cumulative Loss Management



    Cumulative Loss Management is similar to Cumulative Profit Management. It takes actions when the total loss of your account since the start of TradingRouter EA has reached a goal. The inputs are the same as Cumulative Profit Management.



    Multi Strategies Settings




    "EA Magic Number" is used to identify orders in this EA. You can run two TradingRouter EA with different "EA Magic Number", but it should be unique.

    If "Magic Restriction" is On, the action of this TradingRouter EA only affect the orders/positions created by this EA. If "Magic Restriction" is off, the action of this TradingRouter EA will affect all orders/positions including orders/positions created by other EA and created manually.

    The actions of TradingRouter EA which considers "Magic Restriction" are closeall, closealleaoff, closelongbuy, closeshortsell, newsltplong, newstpshort, closeshortpct, closelongpct, closeshortvol, closelongvol, cancellong, cancelshort, cancellongbuylimnit, cancellongbuystop, cancelshortselllimt, cancelshortsellstop, newsltpbuylimit, newsltpbuystop, newsltpselllimit, newsttpsellstop



    Miscellaneous Settings




    "Start Time (Broker Time)" and "End Time (Broker Time)" control when the EA should be active. The EA will only active afer Start Time and before End Time. If you want the EA to be active all the time, you can set Start Time to 00:00 and End Time to 24:00

    Prefix is added before symbol and Suffix is added after symbol. Set them to empty if there is no prefix or suffix for the symbol.


    Prefix Suffix example

    • token=master19dd529542d4b79d2bc4, signal=buy, symbol=AUDUSD, risk_lots=0.1 (note: buy 0.1 lot of AUDUSD.min)