Trading Router

MT4/5 TradingRouter EA Settings

Trading Router Client Token


These are Trading Router client tokens for receiving Tradingview signals on MT4/5

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


This section is settings for using different syntax options in Tradingview alert messages

Stop Loss Synatx


This parameter manages stop loss on MetaTrader 4 and MetaTrader 5

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"
This is an example to show how to specify stop loss source from either Tradingview alert messages or from MT4/5 EA settings

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
This is an example to show how to specify stop loss values as pips

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
This is an example to show how to specify stop loss values as percentage

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
This is an example to show how to specify stop loss values as exact price

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


This parameter manages take profit on MetaTrader 4 and MetaTrader 5

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"
This is an example to show how to specify take profit source from either Tradingview alert messages or from MT4/5 EA settings

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
This example shows how to specify take profit as pips

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
This example shows how to specify take profit as percentage

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
This example shows how to specify take profit as exact price

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


This section is settings for managing risk on MT4/5

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"
This picture shows how to choose source for risk management, it could be either from Tradingview alert messages or from MT4/5 EA settings

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
This picture shows how to manage risk in terms of lots

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
    This picture shows how to manage risk in terms of currency amount

    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
    This picture shows how to manage risk in terms of balance loss percentage

    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
    This picture shows how to manage risk in terms of balance margin loss

    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
    This picture shows how to specify entry price as pips for pending orders on MT4/5
    • 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
    This picture shows how to filter Tradingview alerts according to MT4/5 account balance
    • 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


    This section is the general settings of Trading Router MT4/5 EA

    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"

    This picture shows how to specify pyramiding trading on MT4/5

    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"

    This picture shows how to set close on reverse option for trades on MT4/5

    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"

    This picture shows how to set shadow targets options for trades on MT4/5

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

    Shadow Target On Exmaple
    This picture shows how to turn on shadow targets option for trades on MT4/5
    • 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


    This picture shows how to turn off shadow targets option for trades on MT4/5


    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


    This picture shows how to set slippage on MT4/5
    • 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


    This is another risk management section on Trading Router MT4/5 EA

    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.
    This picture shows how to close 30% of trades when MT4/5 receiving Tradingview signals
    • 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


    This section is settings on MT4/5 EA for managing daily profit

    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
    This picture shows example of how MT4/5 EA manages daily profit in terms of currency

    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
    This picture shows example of how MT4/5 EA manages daily profit in terms of percentage

    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


    This is Trading Router MT4/5 EA settings for managing daily loss

    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


    This is the section on Trading Router MT4/5 EA for managing cumulative profit

    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)"


    This picture shows all the different methods of cumulative profit management

    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
    This picture shows how to stop trades for a day when cumulative profit is achieved in terms of currency

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


    Cumulative Profit Management example 2
    This picture shows how to stop trades for a day when cumulative profit is achieved in terms of percentage

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


    Cumulative Profit Management example 3
    This picture shows how to stop trades for a couple of hours when cumulative profit is achieved in terms of percentage

    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
    This picture shows how to stop trades forever when cumulative profit is achieved in terms of percentage

    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
    This picture shows how to close all positions and stop EA for a day when cumulative profit is achieved

    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


    This is the section on Trading Router MT4/5 EA for managing cumulative loss

    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


    This picture show how to set Trading Router MT4/5 EA to work together with other EAs

    "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


    This is Miscellaneous Settings on Trading Router MT4/5 EA

    "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
    This picture shows how to add prefix and suffix in symbols in the received Tradingview alert messages
    • token=master19dd529542d4b79d2bc4, signal=buy, symbol=AUDUSD, risk_lots=0.1 (note: buy 0.1 lot of AUDUSD.min)


    News Impact Settings


    New
    News Impact Settings on Trading Router MT4/5 EA

    Since version 2.08, you can set time duration for news impact. When it is the news impact time, all existing positions will be closed and pending orders will be deleted, and the EA will ignore any messages until the news impact time finishes.

    "Enable News Impact" is used to enable and disable the news impact feature. If it is true, the new impact feature is enalbe. The default is false.

    "Time Type" specifies if the news impact time is server time or terminal time. The default is server time.

    "Is News Impact File in Common Folder" specifies if your news impact file is in commond folder or in terminal folder. Check News Impact File Folder for details

    "News Impact File" specifies the name of your news impact file. For the content of this file, check News Impact File Syntax

    "News Impact Action" specifies the actions when news impact time comes. There are two actions, one action is "Close all and ignore messages" which will close all positions and pending orders and ignore messages in the news impact time. Another action is "Only ignore messages" which will ignore messages in the news impact time but does not close positions and orders.



    News Impact File Syntax

    Every line in the news impact file specifies a time section for news impact

    one line has 8 fields seperated by ",".

    The format of one line is like this "start time, end time, first day of week/or day of month, last day of week/or day of month, first month, last month, first date, last date

    The first two fields "start time" and "end time" specify the start and end time of the news impact, the format is like HH:MM:SS, For example if "start time" is 09:30:00 and "end time" is 10:00:00, it means the news impact time is from 09:30:00 am to 10:00:00 am. Usually you should set the "start time" a little bit earlier than news start time. For example, if there will be news from 09:00:00 to 09:30:00, you can set "start time" to 08:59:00 so that all positions can be closed before 09:00:00. If you set "Time Type" to server time, the "start time" and "end time" are server time; If you set "Time Type" to terminal time, the "start time" and "end time" are terminal time;

    The next two fields "first day of week/or day of month" and "last day of week/or day of month" specify which day of week or day of month the news impact time will be used. If you use any of MON, TUE, WED, THU, FRI, SAT, SUN, it will be interpreted as day of week, if you use number from 1 to 31, it will be interpreted as day of month. For example:

    • if the "first day of week/or day of month" and "last day of week/or day of month" is MON and FRI, it means the news impact will only work from Monday to Friday;
    • if the "first day of week/or day of month" and "last day of week/or day of month" is WED and WED, it means the news impact will only work for Wednesday;
    • if the "first day of week/or day of month" and "last day of week/or day of month" is 1 and 20, it means the news impact will work from 1st to 20th of a month.
    • if the "first day of week/or day of month" and "last day of week/or day of month" is 2 and 2, it means the news impact will work only on 2nd of a month.
    • If "first day of week/or day of month" is day of week, i.e. MON, TUE, the "last day of week/or day of month" must also be day of week.
    • If "first day of week/or day of month" is day of month, i.e., 1,2, 3, the "last day of week/or day of month" must also be day of month.
    • If "first day of week/or day of month" and "last day of week/or day of month" is not consistent, the news impact time of this line will be invalid. For example if "first day of week/or day of month" is 3 and "last day of week/or day of month" is FRI, they are not consistent and the news impact of this line is invalid.

    The next two fields "first month" and "last month" specify which months the news impact time will be used. It could be JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC. For example if "first month" and "last month" are APR and JUL, it means the news impact will be used form April to July.

    The last two fields "first date" and "last date" specify when the news impact feature can be used, it is like "yyyy.mm.dd". For example, if "first date" and "last date" are 2023.01.01 and 2024.05.30, it means the news impact feature can be used from 1st of January 2023 to 30th of May 2024. "first date" cannot be earlier than 1980.01.01, "last date" cannot be later than 2100.12.31.

    By set all the 8 fields, you can define one news impact time. A news impact file can have multi line, every line define a news impact time

    A news impact file can have more than one line, every line define a news impact time

    If your news impact time cross the overnight, you can use two news impact line to connect it, one ends with 23:59:59 and another starts with 00:00:00. Please see this example

    If you modified news impact file, you have to restart the EA to make your changes effective. For example, if you add one news impact time line or remove on news impact time line or changed the start time of a news impact time line, you have to remove the EA and launch the EA again to make your changes effective.



    news impact file example 1

    Assuming the following is what is in the news impact file

    08:59:00, 09:30:00, FRI, FRI, MAY, MAY, 2024.05.15, 2024.05.31

    The "first date" and "last date" are 2024.05.15, 2024.05.31, so this news impact is active from 2024.05.15 to 2024.05.31

    The "first month" and "last month" are MAY, MAY, so this news impact is active on May

    The "first day of week/or day of month" and "last day of week/or day of month" are FRI, FRI, so this news impact is active on Friday

    The "start time" and "end time" are 08:59:00, 09:30:00, so this news impact time is from 08:59:00 am to 09:30:00 am

    Combining all these 8 fields, we can know that the news impact time is from 08:59:00 am to 09:30:00 am on Friday of May between 2024.05.15 and 2024.05.31, that is from 08:59:00 am to 09:30:00 am on Friday, 17 May 2024, from 08:59:00 am to 09:30:00 am on Friday, 24 May 2024 and from 08:59:00 am to 09:30:00 am on Friday, 31 May 2024



    news impact file example

    Assuming the following is what is in the news impact file

    08:59:00, 09:30:00, FRI, FRI, JAN, DEC, 2024.01.01, 2024.12.31

    The news impact time is from 08:59:00 am to 09:30:00 am every Friday in every month from 2024.01.01 to 2024.12.31



    news impact file example

    Assuming the following is what is in the news impact file

    08:59:00, 09:30:00, 3, 3, JAN, DEC, 2024.01.01, 2024.12.31

    The news impact time is from 08:59:00 am to 09:30:00 am every 3rd of every month from 2024.01.01 to 2024.12.31



    news impact file example

    Assuming the following is what is in the news impact file

    08:59:00, 09:30:00, 3, 5, JAN, DEC, 2024.01.01, 2024.12.31

    The news impact time is from 08:59:00 am to 09:30:00 am every 3rd of every month, every 4th of every month and every 5th of every month from 2024.01.01 to 2024.12.31



    news impact file example

    Assuming the following is what is in the news impact file

    08:59:00, 09:30:00, 3, 3, FEB, MAR, 2023.01.01, 2024.12.31

    The news impact time is from 08:59:00 am to 09:30:00 am on 3rd of February onf 3rd of March from 2023.01.01 to 2024.12.31, that is from 08:59:00 am to 09:30:00 am on 3rd of February 2023, on 3rd of March 2023, on 3rd of February 2024, and on 3rd of March 2024



    news impact file example

    Assuming the following is what is in the news impact file

    08:59:00, 09:30:00, 10, 10, MAY, MAY, 2023.01.01, 2024.12.31

    The "first date" and "last date" are 2023.01.01, 2024.12.31, so this news impact is active from 2023.01.01 to 2024.12.23

    The "first month" and "last month" are MAY, MAY, so this news impact is active on May

    The "first day of week/or day of month" and "last day of week/or day of month" are 10, 10, so this news impact is active on 10th of a month

    The "start time" and "end time" are 08:59:00, 09:30:00, so this news impact time is from 08:59:00 am to 09:30:00 am

    Combining all these 8 fields, we can know that the news impact time is from 08:59:00 am to 09:30:00 am on 10th of May 2023 and from 08:59:00 am to 09:30:00 am on 10th of May 2024



    news impact file example multi lines

    Assuming the following is what is in the news impact file

    08:59:00, 09:30:00, 3, 3, JAN, DEC, 2023.01.01, 2024.12.31

    15:59:00, 15:30:00, 3, 3, JAN, DEC, 2023.01.01, 2024.12.31

    14:59:00, 14:30:00, 6, 6, JAN, DEC, 2023.01.01, 2024.12.31

    The news impact time is from 08:59:00 am to 09:30:00 am on 3rd of every month from 2023.01.01 to 2024.12.31, and from 15:59:00 am to 15:30:00 am on 3rd of every month from 2023.01.01 to 2024.12.31, and from 14:59:00 am to 14:30:00 am on 6th of every month from 2023.01.01 to 2024.12.31



    news impact file example multi lines, connect overnight

    Assuming the following is what is in the news impact file

    23:00:00, 23:59:59, THU, THU, JAN, DEC, 2023.01.01, 2024.12.31

    00:00:00, 01:00:00, FRI, FRI, JAN, DEC, 2023.01.01, 2024.12.31

    The news impact time is from 23:00:00 pm on every Thursday to 01:0:00 am next Friday from 2023.01.01 to 2024.12.31,



    News Impact File Folder

    Your new impact file can be saved in two places, , one is terminal folder, another is common folder

    If you put your news impact file in terminal folder, we should set "Is News Impact File in Common Folder" to false in the EA News Impact Settings, so that the EA will read the news impact file from the terminal folder.

    If you put your news impact file in common folder, we should set "Is News Impact File in Common Folder" to true in the EA News Impact Settings, so that the EA will read the news impact file from the common folder.

    If you want the terminal use its own news impact file, you can use terminal folder, if you want two or more terminals share the same news impact file, you can use the common folder,


    Terminal Folder

    You can follow the steps below to set your news impact file for terminal folder

    1. On terminal, click File => Open Data Folder
    2. Go to MQL5 folder if you use MT5, or go to MQL4 folder if you use MT4
    3. Go to Files folder
    4. Put your news impact file here
    5. On the EA settings, set "Is News Impact File in Common Folder" to false and input the news impact file name











    Common Folder

    You can follow the steps below to put your news impact file into common folder

    1. On terminal, click File => Open Data Folder
    2. Go to Terminal folder
    3. Go to Common folder
    4. Go to Files folder
    5. Put your news impact file here
    6. On the EA settings, set "Is News Impact File in Common Folder" to true and input the news impact file name














    Trouble Shooting

    No news time added log
    could not open the news impact file

    When your news impact file is loaded into EA, you should see messages like the above in Experts log. Every line in your news impact file should have one message in the Experts log

    If you cannot see any message, please check if you have enabled the news imapct by setting "Enable News Impact" to true in the EA settings



    Could not open news impact file
    could not open the news impact file

    If you see this message on the Experts log, it could be the following reason

    1. The news impact file folder is not correct. If you set "Is News Impact File in Common Folder" to false, the news impact file should be in terminal folder. If you set "Is News Impact File in Common Folder" to true, the news impact file should be in common folder
    2. The news impact file name is not correct. Check you input for "News Impact File" on the EA settings is the same file as what is in the terminal folder or common folder


    This news impact line is not processed(no field):
    no field in the news impact file

    If you see this message on the Experts log, it could be the following reason

    1. the line is empty in your news impact file


    This news impact line is not processed(no enough fields):
    no enough fields in the news impact file

    If you see this message on the Experts log, it could be the following reason

    1. the line in your news impact file does not have 8 fields


    This news impact line is not processed(invalid start time):
    invalid start time in the news impact file

    If you see this message on the Experts log, it could be the following reason

    1. The start time in the line is incorrect. The start time should be like HH:MM:SS, HH is from 00 to 23, MM is from 00 to 59 and SS is from 00 to 59. Minimum time is 00:00:00 and the maximum time is 23:59:59.


    This news impact line is not processed(invalid end time):
    invalid end time in the news impact file

    If you see this message on the Experts log, it could be the following reason

    1. The end time in the line is incorrect. The end time should be like HH:MM:SS, HH is from 00 to 23, MM is from 00 to 59 and SS is from 00 to 59. Minimum time is 00:00:00 and the maximum time is 23:59:59.


    This news impact line is not processed(start time later than end time):
    start time later than end time in the news impact file

    If you see this message on the Experts log, it could be the following reason

    1. The start time is a later time than the end time in the line. The start time should be earlier than the end time.


    This news impact line is not processed(invalid frequence):
    start time later than end time in the news impact file

    If you see this message on the Experts log, it means something is wrong in the "first day of week/or day of month" field or "last day of week/or day of month" field. It could be the following reason

    1. The "first day of week/or day of month" and "last day of week/or day of month" is not consistent. If you use Mon,Tue,...,FRI for "first day of week/or day of month", then you have use Mon,Tue,...,FRI for "last day of week/or day of month". If you use 1,2,...,30,31 for "first day of week/or day of month", then you have use 1,2,...,30,31 for "last day of week/or day of month".
    2. There may be typo in your day of week. For example you use TUES instead of TUE.
    3. The day of month is invalid. You have to use number from 1 to 31 for day of month. It is invalid if you use 32.
    4. The first day is later then last day. For example you use TUE, MON which is invalid because TUE is later then MON


    This news impact line is not processed(invalid month):
    start time later than end time in the news impact file

    If you see this message on the Experts log, it means something is wrong in the "first month" field or "last month" field. It could be the following reason

    1. There may be typo in your month. For example you use APP instead of APR.
    2. The first month is later then last month. For example you use MAY, MAR which is invalid because MAY is later then MAR


    This news impact line is not processed(invalid duration):
    start time later than end time in the news impact file

    If you see this message on the Experts log, it means something is wrong in the "first date" field or "last date" field. It could be the following reason

    1. The date format is wrong. The correct format is yyyy.mm.dd. For example, 2024.05.09, 2023.09.23
    2. The year is too small or too large. The year must be between 1980 and 2100. For example 1980..01.01 is correct but 1979.12.31 is wrong. 2100.12.31 is correct, but 2101.01.01 is wrong.
    3. It is not a valid date. For example 2023.02.29 is wrong because there is no 29th February for 2023. 2024.06.31 is wrong because there is no 31th of June, the last day of June is 30th.


    New Imapct Sample Files

    You can download the following sample files and test them. You can make your own news impact file by modifying the sample files

    Sample File 1
    Click news_impact_file_sample_1.txt to download the sample file

    The content of this file is

    09:29:00, 10:00:00, MON, MON, JAN, DEC, 1980.01.01, 2100.12.31
    16:29:00, 17:00:00, MON, MON, JAN, DEC, 1980.01.01, 2100.12.31
    12:29:00, 13:00:00, WED, WED, JAN, DEC, 1980.01.01, 2100.12.31
    10:29:00, 11:00:00, 4, 4, JAN, DEC, 1980.01.01, 2100.12.31
    14:59:00, 15:30:00, 6, 6, MAY,JUN, 1980.01.01, 2100.12.31

    This file has 5 news impact time

    1. from 09:29:00 to 10:00:00 every Monday
    2. from 16:29:00 to 17:00:00 every Monday
    3. from 12:29:00 to 13:00:00 every Wednesday
    4. from 10:29:00 to 11:00:00 on 4th of every month
    5. from 14:59:00 to 14:30:00 on 6th of May and 6th of June every year

    You can put the file news_impact_file_sample_1.txt in to terminal folder and set "News Impact File" to news_impact_file_sample_1.txt

    news impact sample file 1


    Sample File 2
    Click news_impact_file_sample_2.txt to download this sample file

    The content of this file is

    23:29:00, 23:59:59, MON, MON, JAN, DEC, 1980.01.01, 2100.12.31
    00:00:00, 00:30:00, TUE, TUE, JAN, DEC, 1980.01.01, 2100.12.31
    09:29:00, 10:00:00, TUE, TUE, JAN, DEC, 1980.01.01, 2100.12.31

    This file has 3 news impact time, the first two news impact times are connected, so there are actually two news impact time

    1. from 23:29:00 Monday to 00:30:00 next Tuesday
    2. from 09:29:00 to 10:00:00 every Tuesday

    You can put the file news_impact_file_sample_2.txt in to terminal folder and set "News Impact File" to news_impact_file_sample_2.txt

    news impact sample file 2


    Sample File 3
    Click news_impact_file_sample_3.txt to download this sample file

    The content of this file is

    09:29:00, 10:30:00, MON, MON, JUN, DEC, 2023.06.01, 2023.12.31
    09:29:00, 10:30:00, MON, MON, JAN, MAY, 2024.01.01, 2024.05.31
    09:29:00, 10:30:00, 6, 6, JUN, DEC, 2024.06.01, 2024.12.31
    09:29:00, 10:30:00, 6, 6, JAN, DEC, 2025.01.01, 2025.12.31

    This file has 4 news impact time, the first news impact time is every Monday from June to December 2023 and the second news impact time is every Monday from January to May 2024, the first news impact time and the second news impact time have the same start time/end time, hence the first news impact time and the second news impact time are connected. For the same reason, the third and fourth news impact time are also connected. Hence there are actually 2 news impact time in this file

    1. from 09:29:00 to 10:30:00 every Monday from June 2023 to May 2024.
    2. from 09:29:00 to 10:30:00 on 6th of every month from June 2024 to December 2025

    You can put the file news_impact_file_sample_3.txt in to terminal folder and set "News Impact File" to news_impact_file_sample_3.txt

    news impact sample file 3