mt4 telegram bot trader ea (connector version)

27

Upload: others

Post on 01-Nov-2021

44 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MT4 Telegram Bot Trader EA (Connector Version)
Page 2: MT4 Telegram Bot Trader EA (Connector Version)

MT4 Telegram Bot Trader EA (Connector Version) – Setup Guide

and Manual

This EA is designed for use on the MetaTrader MT4 trading platform, and aims to help automate

trade placement and money management of trade signals received via the popular Telegram

messaging platform. Integration of the MT4 platform and telegram is achieved via the official

Telegram API and the supplied Windows “Connector app”.

Disclaimer: Trading Forex and other derivatives carries a high risk, and the author is not responsible

for signals nor any undesirable operations of the EA. Users should ensure the EA is suitable for their

needs and that they are familiar with all the features before using it on a live account. Testing on a

Demo account first is highly recommended.

Getting started

1. Connector App Installation – (requires Windows 10)

- The connector app needs to be installed on the same machine that is running your MT4

trading platform. This app works in the same way as your normal Telegram app and

allows a secure method of connecting to telegram to read signal messages. To install,

simply open the supplied TBotTraderEASetup.exe file and this will run through the setup

program and install all the necessary files. We recommend using your default program

files folder, but you can specify an alternative folder during the setup if you wish.

- After installation, open the TelegramBotTraderEA Connector app (via the desktop

shortcut created during the installation, or directly opening the

“TelegramBotTraderEA.exe” file). A window will open that will guide you through the

initial setup process. To exit the connector app at any time just use the CTRL-C key

combination or click <Cancel> in a dialogue box.

- When asked enter the phone number associated with your Telegram account – this is

needed to authenticate yourself with Telegram, so the connector app can access your

signal messages – NOTE: the entry should not include the + character that is often used

when displaying international format numbers. Just enter numbers.

-

- You will receive a login authorisation code via your Telegram account to allow the

connection. Enter the code you receive now:

- The connector app will confirm the connection to telegram if successful:

Page 3: MT4 Telegram Bot Trader EA (Connector Version)

- Enter the Username/Key supplied in your purchase/demo email.

- The connector app will now list the chat IDs of your groups/channels so you can easily

select the one you wish to use as your signals input for MT4. Some groups/channels

may use special characters in their name which are not easily displayed on Windows, so

in case it is not clear from the list displayed a file with these details is also created. In

your documents folder you will find a folder named “TelegramBotTraderEA” which

contains a file “TelegramBotTrader.txt” which lists all the groups/channels shown on

screen, but with any special characters displayed properly.

- Each group or channel on Telegram is given a unique ID to identify it. From the list

displayed (or the text file) enter the ID that you would like to use. Private

channels/groups begin with “-“ so ensure this is included when using these types of

channels/groups.

Page 4: MT4 Telegram Bot Trader EA (Connector Version)

- *Advanced licence users may enter additional groups when prompted. Groups are

separated with a comma. Enter 0 to skip the monitoring of additional groups.

- Enter a Windows port number to use for communication with the MT4 EA. This must

match the setting used in the MT4 EA – unless you need to change this, we recommend

using the default value of 51551.

- The connector app can also send information to you on telegram about any trades that

are executed by the MT4 platform from signals. In most cases this will be different to the

group/channel that you receive Telegram signals from (unless the group is your own), so

enter this ID now. If you do not wish to receive any confirmation of trades via

Telegram then simply enter 0 to disable it. You could for example, setup your own

telegram chat/group to receive confirmations. Messages from MT4 to Telegram can

also be disabled within the EA settings. If either is set to block messages, no messages

will be sent.

- Telegram REPLY messages can optionally be sent to MT4. This can be useful if Telegram

reply messages contain signal updates, such as to close or partially close an order. The

EA will search for the symbol in the original message and look to see if the reply contains

a trading command to close the original order. Currently the EA only supports

closing/partial closing of orders, but future updates will bring additional trading

functions.

Page 5: MT4 Telegram Bot Trader EA (Connector Version)

- *Advanced licence users can now setup modification settings for incoming messages.

This is useful to pre-process/parse messages to better suit automated trading. Text can

be substituted or removed from the incoming message before being processed by MT4.

Such use may include modifying symbols to match MT4, altering text to better support

MT4s limited character support compared to telegram or formatting text to match

multiple groups being monitored.

First enter the Text that is to be searched for in the message (click submit to skip this if

you don’t wish to process messages):

- Next enter the Text to be used instead, when the search text is found (to simply delete

the found text just click submit):

- Repeat this process for any other text to search for as above, finishing by clicking

<submit> with a blank entry when you are complete.

When a match is found in an incoming message you will receive a confirmation

notification, along with the final message sent to MT4:

Page 6: MT4 Telegram Bot Trader EA (Connector Version)

The connector app is now ready to connect to the MT4 EA:

- Now setup the EA on MT4….

Page 7: MT4 Telegram Bot Trader EA (Connector Version)

2. Configure the MT4 EA

- As part of the setup process the TelegramBotTraderEAConn.ex4 should have been

installed in the EXPERTS folder of your MT4 installation – if you stored it anywhere else

during the setup routine you will now need to manually copy it into the EXPERTS folder.

To find your MT4 EXPERTS folder easily – Open MT4 and Use the menu item File/Open

Data folder which will open your main MT4 folder. In this folder navigate to MQL4 then

the Experts folder. This is where the EA file needs to be stored. It will normally be: C:\Users\{yourusername}\AppData\Roaming\MetaQuotes\Terminal\{yourMT4InstallationID}\MQL4\Experts

- Restart MT4 (the easiest way), or manually refresh the EA list (right click in the Navigator

window and choose refresh) to update the MT4 EA list. The new EA

(TelegramBotTraderEAConn) should now be available in the MT4 Navigator window

under “Expert Advisors”. Use CTRL-N to show the navigator panel if required.

- Before running the EA, we have to add a URL to the List of allowed WebRequest URLs in

MT4, so that it can talk to the Telegram server and receive messages:

Click on menu Tools --> Options, and then click on the menu tab Expert Advisors.

- Check the box - Allow WebRequest for listed URL, and add the following URLs

https://api.telegram.org

https://telegramtrader.uk

- Ensure the allow automated trading / Allow DLL imports is checked. This is required to

allow the EA to place trades and communicate with the connector app.

Click the OK button to save the entries.

- Next, attach the EA to any MT4 chart (simply drag the TelegramBotTraderEAConn entry

onto a chart). Values are pre populated to work with some signal providers, but should

be customised for your signals provider and your own money management plan – full

details of fields are explained later in the guide. NOTE: DO NOT ADD TO MULTIPLE

CHARTS UNLESS EXPLICITLY ADVISED TO DO SO – IT WILL TRADE ALL AVAILABLE

SYMBOLS FROM A SINGLE CHART.

Page 8: MT4 Telegram Bot Trader EA (Connector Version)

If successful (and the connector app is running), the status bar should be shown as follows in the left

corner of the chart along with the EA name. The connector app will now also show it is connected:

When in “money management only” mode or disconnected from the connector app the EA status

will be shown as follows:

NOTE: After setting up the EA and connector app it is recommended to test the settings with live

trading disabled. This allows the testing of signal messages without the need to open any trades. To

test the EA initially it is recommended that you setup a private telegram group that you can send

test signal messages to. That will help to familiarise yourself with the EA functions without the risk

of using a live account. We also recommend using a demo account initially with signals to ensure

the EA meets your needs before using it on a live account. DISCLAIMER: Whilst the EA has been

tested extensively with a variety of brokers and platforms, we can’t account for all possible signals or

platform configurations and therefore cannot be held responsible for any adverse effects or losses

caused by its automated functions. As with all EAs, traders should monitor automated actions

closely to ensure they are desirable.

MT4 Auto trading can be disabled either in the MT4 EA settings or by ensuring the Auto trading

button at the top of the platform main screen is deselected. When disabled it will show a red icon.

Sending a message to the monitored Telegram chat will result in messages being received by the

connector app and MT4 platform. Messages can be seen in the Connector app display and the

output from the EA can be examined using the “experts” tab log on the MT4 platform to verify its

operation.

MT4 Log:

Page 9: MT4 Telegram Bot Trader EA (Connector Version)

Valid signal messages can also be checked. An example entry in the log for a sell signal is shown

below, showing the received text, with the top line showing how the EA will respond:

Page 10: MT4 Telegram Bot Trader EA (Connector Version)

MT4 TelegramBotTraderEA – Settings Guide

The EA offers multiple settings to allow a range of customisations to suit different trading styles.

Please familiarise yourself with the settings before using the EA on a live account.

Page 11: MT4 Telegram Bot Trader EA (Connector Version)

General note: ALL search fields are case sensitive – “Buy”,“BUY” and “buy” are treated differently!

EA Display Font / Font size / font colour – controls the text of the info display on the chart.

Top / Left offset value – controls the location of the info display on the chart.

Registered Username / Licence Key – Use the information supplied on purchase.

Server Port – This is the port that the EA communicates with the connector app. It must match the

connector app settings. Leave at the default setting of 51551 unless you need to change this.

EA Mode – use this setting to control how the EA works. Two settings are available:

1) Normal – Process Signals: The EA will process Telegram signals and automate trade placement,

along with carrying out any selected money management functions.

2) Money Management Only: The EA will only perform Money management functions, such as

Break even and Trailing Stop functions. This is useful if you wish to continue to manage existing

trades but don’t want to process any new signals. The EA does not connect to the connector

app in this mode.

Magic Number – Orders placed with the EA will have this magic number assigned to them. The EA

uses this to manage trades. An EA will only manage orders with this magic number assigned when

the order was opened. MT4 does not allow magic numbers to be changed after a trade is opened.

Open Order Text – use this to specify the message text that identifies a message as a valid signal for

opening a trade position. This text should ideally be unique to separate normal messages from signal

messages. For example, if the signal messages have the words “trade signal” in the message but

normal messages don’t, then use this text in this field. Multiple text matches can be specified by

separating words or phrases with a comma “,”.

Long order text – use this to specify the text that identifies a message as a buy signal.

Short order text – use this to specify the text that identifies a message as a sell signal.

Entry price locator – use this to specify the text that precedes the signal entry price. The EA uses the

entry price of the signal and compares it against the current market price from the MT4 broker – see

“Max signal difference in pips”. If your signal doesn’t have one, use the Allow instant orders without

an entry price to allow orders to be opened without an entry price.

Allow instant orders without an entry price – if set to true, market orders will be made even if an

entry price is not specified in received messages (or if it doesn’t have a locator to find it). Messages

will be checked first to see if they contain an entry price locator (and this will be used if found) but if

one is not found a current market order will be opened if it meets the other order conditions (open

order text/long order text/short order text). WARNING: With this set there are more opportunities

for undesirable trades to be triggered if messages are received containing trigger words. We

recommend using Excluded Signal Text to help prevent sales or market commentary messages

triggering trades if this setting is used. Pending orders will of course continue to need an entry price

in order to trigger.

Page 12: MT4 Telegram Bot Trader EA (Connector Version)

Close Direction required in messages (Hedging) – Use to specify if close messages need a direction

in the signal. This is useful if both Long and Short orders are held, and signals should only close

orders in one direction. If set to false ALL orders for a symbol will be closed if a close message is

received.

Close orders text – use this to specify the text that identifies a message as a Close order signal. If the

Close Direction required in messages (Hedging) is set to false, this text when identified in a message

will close ALL orders for a given symbol. The message received MUST also contain a valid trade

symbol to trigger, eg. If this text is “CLOSE”, a message of CLOSE GBPUSD will close GBPUSD orders.

The following two fields will be ignored. If the Close Direction required in messages (Hedging) is true,

this field will identify a message as a close order signal, but a direction MUST be specified in the

following two fields to identify a trade direction.

Long order close text (Hedging) – use this to specify the text that identifies a long order close signal.

Used when Close Direction required in messages (Hedging) is set to true.

Short order close text (Hedging) – use this to specify the text that identifies a short order close

signal. Used when Close Direction required in messages (Hedging) is set to true.

Partial close text – use this to specify the text that identifies a partial close signal. A signal direction

can also be specified via the Short/Long order close text fields. A valid symbol must also be specified

in the signal message. If no direction is specified, ALL active orders for the signal symbol will be

reduced.

Partial Close Mode – use this to specify the % reduction in trade value when a partial close signal is

received. Three options are available – 50%, 33%, 25%. Lots will be rounded to the nearest

tradeable value, which may vary by broker.

Close Orders on Opposite Signal – If set to true a signal received will close any orders open in the

opposite direction.

Stop Loss locator – use this to specify the text that precedes the signal Stop Loss.

Take profit 1/2/3 locator – use this to specify the text that precedes the TP1/2/3 price in the signal.

If you wish to trade only TP1, leave TP2 and TP3 blank. To trade TP1 and TP2 leave TP3 blank. The

EA will open a trade for each TP level. For risk-based trades the EA will divide the lot size by the

number of trades being opened (see Money Management). For example, if the account equity and

stop loss placement allows a risk of 0.3 lots on a trade and TP1, TP2, and TP3 are all traded, each

order placed will be for 0.1 lots. Similarly, if TP1 and TP2 are traded and the lot size per trade is 0.5,

each order will be for 0.25 lots.

Leave TP3 Level open – some trading plans aim to take advantage of longer-term trends and

therefore have no fixed final TP level. Use this option to leave a TP3 trade with no Take Profit set

instead of using the signal TP. Remember to manage the trade via the Trailing stop or Break Even

function (EA settings) or another method.

Buy Limit Order Text – use this to specify the text that identifies a message as a Buy Limit signal.

Sell Limit Order Text – use this to specify the text that identifies a message as a Sell Limit signal.

Page 13: MT4 Telegram Bot Trader EA (Connector Version)

Buy Stop Order Text – use this to specify the text that identifies a message as a Buy Stop signal.

Sell Stop Order Text – use this to specify the text that identifies a message as a Sell Stop signal.

Excluded Signal Text – use this to specify the text that identifies a message to exclude from

processing. This offers an additional safety feature to help prevent unwanted trading. Multiple

search phrases or words to match can be separated by commas “,”.

Symbols in signals not to trade – use this to specify any trade symbols that should not be traded,

even if messages are received with this symbol. This is useful if you receive signal messages with

multiple trading instruments, but do not wish to trade them all. Multiple symbols can be separated

with commas, so if you do not wish to trade USD/JPY and EUR/USD then enter “USDJPY,EURUSD” if

your broker symbol is USDJPY and EURUSD in the MarketWatch window on MT4.

Maximum Open Orders for a Symbol (0-Unlimited) – Use this to specify the maximum number of

orders that can be open at a time for each trading symbol. Buy and Sell orders are counted

separately to allow for hedging, so if this is set to 2 for example, both 2 x Buy and 2 x Sell orders can

be opened by the EA before a block is placed on opening new orders. The limit is checked just once

at the time a new order signal is received, so triggering multiple TP level orders may mean this value

is exceeded. Likewise, if trading multiple TP levels consideration should be given to the fact that the

EA will consider each TP level order as a separate order, so trading a signal using TP1, TP2 and TP3

will be considered 3 orders when checking later if other orders can be opened, rather than just 1.

Take Profit Mode – this setting allows flexibility to control the Take Profit levels of your trades.

Several modes are available:

1) Use Signal TP Level(s): The EA will process Telegram Signals and look for TP levels in the

signal messages. If none are found, no orders will be opened.

2) On TP Signal Fail – Leave TP Open: The EA will process Telegram Signals and look for TP

levels in the signal messages. If found, they will be used. If none are found and the order

meets all other EA criteria a single order will be opened and the TP level left open. This is

best used with the BE or Trailing stop functions to lock in profit if the trade moves into

profit.

3) On TP Signal Fail – Use Fixed TP Levels: The EA will process Telegram Signals and look for TP

levels in the signal messages. If found, they will be used. If none are found and the order

meets all other EA criteria, order(s) will be opened and the TP levels placed based on

settings in the Fixed TP1/2/3 pips fields. Entries in Fixed TP level(s) will open order(s) and

set the order to the corresponding TP level, in the same way as if the EA had found the TP

level in the signal. For example, if the Fixed TP1 is set to 20, and Fixed TP2 to 40, and the EA

is unable to find TP levels in the signal, then 2 orders will be opened if the rest of the EA

criteria are met for a valid trade (such as spread, signal difference etc.). The first order will

have a TP set at 20 pips above/below the open price (TP1), and the second order 40 pips

above/below the open price (TP2). Note: If using this setting Fixed TP1 Pips must be set to

at least 1 (or your minimum broker distance from market price) or the EA will close/orders

will fail, as the settings won’t be valid.

4) Force Own TP Always: The EA will process Telegram Signal messages, but will ignore any TP

levels in the signals. Fixed TP levels set in the Fixed TP1/2/3 fields will be used instead for

Page 14: MT4 Telegram Bot Trader EA (Connector Version)

any orders. Use 0 in any fields that you wish to ignore. Note: If using this setting Fixed TP1

Pips must be set to at least 1 (or your minimum broker distance from market price) or the EA

will close/orders will fail as the settings won’t be valid.

Fixed TP1/TP2/TP3 pips if using own TP – Specifies the TP levels if using manual TP levels instead of

signal values. Use this with the Take Profit Modes 3 and 4.

Max Signal Difference in Pips – Use this filter to prevent late signals from activating trades, or from

significant broker price differences. If the message signal price, compared to the broker quote, is

different by more than this limit a trade will be rejected. This setting is ignored if instant orders are

allowed in the Allow instant orders without an entry price setting. Note that signal and broker

market prices can be different if they are from different brokers, so some trial and error may be

needed with this setting.

Max Spread in Points – Use this filter to prevent trades being opened when the broker spread on the

trade symbol is greater than this amount.

Symbols to exclude from Max Spread limit – You may wish to exclude some symbols from spread

limits when placing trades. This is often useful if you are trading both currencies and indexes where

spreads may be much more on indexes but you still wish to protect trades from large spreads on

some currencies. Symbols entered here will not be filtered by the Max Spread in Points settings.

Broker Symbol(s) to apply pips modifier – Brokers do not always report the correct values within the

MT4 platform for symbols available for trading. This is often true for non-FX symbols such as Gold

and indexes. In order to trade these without pip entries being incorrect processed you can modify

the calculation to take account of these inconsistencies without affecting other trades. Simply add

the broker symbols (as they appear in the navigator window) that you wish to modify pips values for.

Multiple symbols can be added and separated with a comma.

Pips Modifier Value – Use this field to specify the amount to modify the pips value by for symbols set

in the Broker Symbol(s) to apply pips modifier. For example, if GOLD is trading incorrectly and pip

values are causing SL and TP levels to be set incorrectly too high then after setting GOLD in the field

above set the value here that the pips value should be corrected by. If a 1 pip setting for SL/TP is

causing an actual trade of 10 pips then set x10 – 0.1 in this field. For 100 pips set x100 – 0.01 in this

field. Some trial and error may be required depending on how your broker quotes these symbols.

Use Fixed Lots for Trades – specifies if the trade lot size is fixed for orders. If false then risk-based lot

size trade management is used.

Lot size for fixed lots – if using fixed lot sizes, specify the size for each trade. Note that EA will open a

trade with this lot size on each order, so if trading TP1, TP2 and TP3 the EA will open 3 trades, each

with this lot size. A value here is also required if the missing SL modes set below use a fixed lot size if

a SL is not found in the signal. An error will be generated by the broker if this is 0 and you try to

open a trade.

Missing SL Mode – This setting controls how trades are handled if the Stop Loss is missing from trade

signals. The following options are available:

Page 15: MT4 Telegram Bot Trader EA (Connector Version)

1) Block trades without a Signal SL – in this mode any signal that is received without a Stop Loss

value will be rejected.

2) Use Fixed Lots No SL - If using Risk based trading then the EA requires a SL value to calculate

lot sizes. With this option set, trades can be opened even if the signal message received is

missing a SL value (or fails to parse it), as fixed lot values will be used (lot size for fixed lots)

even if risk based trade lots are normally being used. This is useful if you normally trade risk

based lot sizes, but occasionally receive signals without a SL value, such as “Buy GBPUSD @

1.2915”, which would normally fail to open a trade. Trades will be opened without a SL.

Note: trades opened without Stop Loss protection can increase risk substantially. If using

fixed lots (Use Fixed Lots for Trades=true) then this setting will continue to use fixed lots for

any trade signals, and both signals with and without a SL value will be processed. A lot size

must be specified in the Lot size for fixed lots setting.

3) Use Fixed SL without a SL – The EA will attempt to process a SL in the signal message and use

this if one is found. If a SL is not found then fixed SL values will be used (set in Fixed SL pips

if using own SL).

4) Force Fixed SL Always – The EA will always use a fixed SL regardless of signals received. (set

in Fixed SL pips if using own SL)

Fixed SL Pips if using own SL – Use this to specify the number of pips for a Stop Loss when this is

forced by the EA (see options 3 and 4 above).

Equity Risk Percent Per Trade – if using a risk-based lot size (Use Fixed Lots for Trades is FALSE)

specify the Risk in percent. The EA automatically calculates a trade size when placing orders based

on available equity and SL risk. If trading TP1, TP2 and TP3 the overall trade risk is divided across the

three orders. For example, if the account equity and stop loss placement allows a risk of 0.3 lots on a

trade and TP1, TP2, and TP3 are all traded, each order placed will be for 0.1 lots. Similarly, if TP1 and

TP2 are traded and the lot size per trade is 0.5, each order will be for 0.25 lots. Note: This setting

can only be used if signals contain a SL value.

Max Lot - on risk based trades – Use as a filter to specify the maximum lot size for any trade. If the

risk calculated lot size is greater than this value then this value will be used, otherwise the risk based

lot size is used. Can be useful to prevent large lot sizes being used if SL levels are very close to the

market price. Only applicable to risk based trades.

Minimum free margin – account protection filter to prevent trades being opened if the account free

margin size is less than this.

Symbols in Signals not to trade – filter to prevent the opening of trades on specific trade symbols.

Break Even Mode – This setting controls how the Break Even money Management function works.

The following options are available:

1) Move to Break Even - Off – in this mode the Break Even function will be deactivated.

2) Move to Break Even - Fixed – in this mode the Break even function will be triggered when it

reaches the fixed trigger levels set in the Pips Profit for BE1/2/3 trigger settings.

3) Move to Break Even - Dynamic – in this advanced mode the Break Even levels will be set by

the order Take Profit levels, and can vary depending on each signal order placed. The first

Page 16: MT4 Telegram Bot Trader EA (Connector Version)

Break Even Trigger will activate when the TP1 level is reached. Remaining order(s) will have

their SL moved to break even (open price) at this trigger level. If a TP3 level order remains

when TP2 is hit, the remaining order will move its SL to TP1. This is a useful function if you

wish to use Break Even functions to lock in profit, but signal distance to TP levels varies

between signals. To fully benefit from this function, it is recommended that the EA remains

active throughout the trade cycle to correctly track the orders. If the EA is removed and

later activated, or the mode is activated after trades are placed it will use existing remaining

orders to calculate Break Even positions based on remaining TP levels. Under these

circumstances the SL will move to the open price (or move remaining orders to a higher level

if a SL is already above this) when the next TP level is hit. Subsequent orders will behave as

normal, provided the EA remains active and in this mode.

Pips Profit for BE1 Trigger – set the number of pips profit that will trigger the Break Even 1 function.

Use this setting when the Break Even Mode is set to Fixed.

Pips Profit for BE2 Trigger – set the number of pips profit that will trigger the Break Even 2 function

(or set to 0 to not use this level). Use this setting when the Break Even Mode is set to Fixed.

Pips Profit for BE3 Trigger – set the number of pips profit that will trigger the Break Even 3 function

(or set to 0 to not use this level). Use this setting when the Break Even Mode is set to Fixed.

Break Even 1 SL Gain From Open Price – The number of pips profit to set the Stop Loss of active

trades at when the BE1 level is triggered. Use this setting when the Break Even Mode is set to Fixed

or Dynamic.

Use Trailing Stop – Set to TRUE to use the trailing stop money management function.

When to Trail – Pips profit level to start the trailing stop function.

Trail Amount – Pips Trailing Stop distance from market price when the trailing stop is active.

Broker Symbol Prefix – Some brokers use prefixes on MT4 trading symbols, so use this field to

specify the Broker Symbol prefix to allow signals to be processed properly. For example, if the

broker symbol on MT4 is mUSDJPY use m as the entry in this field so signals can be matched easily –

signals sent as USDJPY will be recognised correctly and processed by MT4 as mUSDJPY.

Broker Symbol Suffix – Some brokers use a suffix on MT4 trading symbols, so use this field to specify

the broker symbol suffix to allow signals to be processed properly. For example if the broker symbol

is USDJPY(£) on MT4 then enter (£) in this field, so signals received as USDJPY will be recognised

correctly and processed by MT4 as USDJPY(£).

Trade Symbols to Map to Broker – If the signal message symbols differ significantly from the broker

symbols you can manually map them here. For example, GOLD can often be represented by

XAUUSD. So for example, if your signal message uses US30 and your MT4 broker uses DJI30, simply

enter US30:DJI30 in this field. Multiple symbols to be mapped can be separated by a comma, eg.

GOLD:XAUUSD,US30:DJI30.

Page 17: MT4 Telegram Bot Trader EA (Connector Version)

Disable Messages to Telegram – prevents the EA from sending messages to Telegram. This may be

useful if you have your bot in a public group or channel and do not wish it to confirm orders placed.

Note: Messages can also be blocked in the Connector app settings.

Page 18: MT4 Telegram Bot Trader EA (Connector Version)

Money Management

Even with the greatest signals, traders who do not employ good money management will eventually

pay back their winning trades to the market. For this reason, there are several money management

features included in the EA to help maximise winning trades and minimise losses (remember, all

successful traders lose trades, but managing them, and winning trades is key).

Order Placement

Each signal received by the EA will generate order(s) based on the symbol, direction, take-profit

level(s) and Stop loss level. One trade order is placed for each TP level received by the EA (if settings

allow). If TP1, 2, and 3 levels are specified in the signal (and EA settings are set to parse these

messages) then three orders will be placed. If Risk based money management settings are used,

each order placed will carry a third of the total risk. If TP1 and TP2 are specified, two orders are

placed with half the risk on each order. If only TP 1 is specified (or set in the settings) then a single

order is placed with the full risk-based trade value. All orders are set with the same initial Stop Loss

level with each TP level being set to the corresponding TP levels of the processed signal. See the

examples below:

Signal/EA TP levels

Order 1 Order 2 Order 3 Risk Based lots

Fixed lots

TP1 Signal SL and TP1

Not placed Not placed Risk based lot size

Fixed lot value for order

TP1,TP2 Signal SL and TP1

Signal SL and TP2

Not placed 2 orders at ½ risk lot size

2 orders at fixed lot value

TP1,TP2,TP3 Signal SL and TP1

Signal SL and TP2

Signal SL and TP3*

3 orders at ⅓ risk lot size

3 orders at fixed lot value

Although we don’t recommend this approach it would be possible to select either the TP2 or TP3

levels for the TP target of a single trade if the “Take profit 1 locator” was set to recognise the text of

the TP2 or TP3 signal. *Note: If Leave TP3 Level open is set, order 3 will have no Take Profit level

set.

Scaling out

As separate orders are placed for each TP level, winning trades will automatically scale out as TP

levels are reached. For example, if TP1, 2, and 3 orders are placed, the trade value is reduced by 1/3

if TP1 is hit, 2/3 if TP2 is hit and the final 1/3 is closed when TP3 is hit.

Page 19: MT4 Telegram Bot Trader EA (Connector Version)

Break Even function

The break-even function allows trades to be protected from loss when they reach a certain level of

profit. Additionally, it is possible to lock in profit via the Break Even Level 1 gain setting. The system

operates as follows:

When a trade order reaches the profit amount set in the Pips Profit for BE1 Trigger setting, the Stop

Loss will move to the level of profit specified in the Break Even 1 SL Gain From Open Price setting.

When a trade profit level reaches Pips Profit for BE2 Trigger the Stop Loss of orders will be moved to

the BE1 trigger level to lock in more profit. Setting this level to 0 will deactivate this level.

A final level Pips Profit for BE3 Trigger when triggered will move the stop loss of orders to lock in

profit at BE2 trigger level. Setting this level to 0 will deactivate this level.

When set at default settings (20,40,60 and 3) when an order reaches 20 pips profit the stop loss will

move to preserve 3 pips of profit. At 40 pips of profit the Stop loss will move to preserve 20 pips of

profit. At 60 pips of profit the stop loss will move to preserve 40 pips of profit.

Trailing Stop

The trailing stop function moves the Stop Loss level of an order in the direction of profit once the

When to Trail level is reached. The trailing maximum distance of the stop loss from the market price

is set by the Trail Amount.

When Use Trailing Stop is set to TRUE and the When to Trail level of profit pips is reached, the

trailing stop will activate and move the stop loss to a distance in pips set by the Trail Amount.

For example, if the When to trail is set to 30 pips and the Trail Amount is set to 20 pips an order that

reaches 30 pips profit will have its stop loss moved to a position 20 pips below (buy order) or above

(sell order) the current market price. If the price continues to move in the direction of profit the

stop loss will maintain a distance of 20 pips behind the market price. If the trade moves against the

profit direction the Stop loss will remain at its current level until it is hit, and the trade is closed, or

the profit direction resumes again. If the level between the market price and the stop loss reaches

20 pips again, the stop loss will move in the profit direction again at a distance of 20 pips.

Page 20: MT4 Telegram Bot Trader EA (Connector Version)

Had we not used good money management in our trading plan, our overall trading day could have

ended in a loss, even with the same trades being taken, as we would have only won 2 trades and lost

7!

An example of how good money management helps: On

the left we have 3 trades of USDCAD, GBPUSD and

GBPJPY. All were taken with TP1, TP2 and TP3 levels set

as targets. Both USDCAD and GBPUSD reached TP1,

closing one trade in profit and leaving two open. After

this, both currencies went against the trade direction. As

the EA moved our stop loss to +3 pips all trades closed in

profit. On GBPJPY, again we took 3 trades and the EA

moved our stop loss soon after the trade was in profit.

None of our targets were met, but having moved our

stops 3 pips above our entry price, trades stopped out in

profit when the market moved against us.

Page 21: MT4 Telegram Bot Trader EA (Connector Version)

Message and Setup Examples

Trade Signal:

Open Order Text – Use proper risk management

Take Profit 1 Locator text – Take profit 1 at

Take Profit 2 Locator text – Take profit 2 at

Entry price locator – @

Stop Loss Locator text – Stop loss at

The above settings will open 2 trades if other filter conditions

are met. One order for TP1 and one for TP2. TP3 will be

ignored as no take profit locator is specified.

Trade Signal:

Open Order Text – @

Take Profit 1 Locator text – TP

Entry price locator – @

Stop Loss Locator text – SL

The above settings will open 1 trade if other filter conditions

are met. As the @ symbol is a unique character for signals, this

can be used to identify trading signals. It can also used to

identify the entry price.

Telegram Replies:

GBPUSD - A valid signal was received and processed, but the

order failed the spread filter as the broker spread was greater

than the setting of 50.

GBPJPY – A valid signal was received and orders placed for TP1

and TP2.

EURNZD – A valid signal was received, but the MT4 broker does

not offer trading on the symbol.

Page 22: MT4 Telegram Bot Trader EA (Connector Version)

Advanced EA Use and Integration

While not within the scope of this guide, the use of the EA allows the integration of trading functions

with any system that is capable of interaction with Telegram. For example, Tradingview.com offers a

very sophisticated charting platform, capable of generating alerts that could be used for trading

signals. Through the use of webhooks and the Bot API it is possible to automate these signals. It

could also be used with other automated trading systems and platforms. To help get you started

we’ve provided some examples below. This assumes you have Telegram Bot setup – full details

available via Telegram: https://core.telegram.org/bots#3-how-do-i-create-a-bot

TradingView.com example:

Setup an alert on your desired signal and choose to generate a webhook URL.

For a simple fixed content message use the following format (you can also test this link in a

browser):

https://api.telegram.org/YourBotAPIKey/sendMessage?chat_id=ChatOrGroupID&text=Your_Message_Text

To parse dynamic values from TradingView, use the following base URL for your webhook and enter

the alert message according to the JSON/TradingView format rules.

Example:

Webhook URL: https://api.telegram.org/botYourBotAPIKey/sendMessage

Example Alert message:

{"chat_id": "ChatOrGroupID","text": "Sell EURGBP @ {{plot_2}} TP {{plot_5}} SL {{plot_6}} My Trading Signal"}

The {plot_2} and other values are dynamic values supplied by the TradingView chart that generated

the alert.

We recommend visiting https://tradingview.com for further detailed guides.

Page 23: MT4 Telegram Bot Trader EA (Connector Version)

Use When Trading with Symbols that Require Different Strategies (Recommended for Advanced users only)

Normally the EA should be added to a single MT4 chart only, and the EA will trade any symbols that

it receives signal messages for that match the parameters set. However, there may be times when

there is a need to set different settings for trading different symbols (such as fixed SL or lot size). It

is therefore possible to add the EA to a second chart in order to trade the different symbols with

different settings. WARNING: by default, a second EA added to MT4 will duplicate orders, so care is

needed to ensure the second EA only trades the symbols that require different settings to the first

EA in use. Likewise, the first EA must be configured to ignore trades destined for the second EA

settings. The following approach is therefore needed in order for trades to be executed and

managed correctly if using multiple instances of the EA:

This example assumes you are trading EURUSD and XAUUSD only and no messages with other trade

symbols will be sent in the signal messages chat.

1. Load the EA on to one chart (Chart 1) and setup parameters for your 1st trading symbol (EURUSD).

Make a note of the Magic Number used (default is 1299).

2. In the "Excluded signal text" enter text that is included in the signal message for the 2nd symbol

that you wish to trade (XAUUSD) to prevent this EA opening trades for the 2nd Symbol. An example

might be the symbol of the trade which would be used in the message (multiple symbols could be

added if required – XAUUSD,GBPUSD etc). The “symbols in signals not to trade” can also be used to

filter out trades, so adding XAUUSD in this field on chart 1 will prevent XAUUSD trades being

opened.

3. Load the EA onto a second chart (Chart 2) and setup parameters for the 2nd trading symbol

(XAUUSD). Change the magic number to something other than the first chart (such as 1300).

4. In the "Excluded signal text" enter text that is included in the message for the 1st symbol that you

wish to trade (EURUSD) to prevent this EA opening trades for the 1st Symbol.

5. Monitor carefully on a demo account to ensure it works as you require before adding a live

account!

Our EA 1 settings for trading EURUSD (Chart 1):

Magic Number: 1299

Excluded signal text: XAUUSD or Symbols in signals not to trade: XAUUSD

Our EA 2 settings for trading XAUUSD (Chart 2):

Magic Number: 1300

Excluded signal text: EURUSD or Symbols in signals not to trade: EURUSD

Page 24: MT4 Telegram Bot Trader EA (Connector Version)

Use When Trading with Multiple Signals Groups (Advanced licence required)

WARNING: Trading with multiple signals groups requires careful planning and setup, to ensure risk is

managed appropriately. Care should be taken not to over expose on instruments that may be

traded simultaneously in multiple groups/chats.

First, setup the connector app with the additional signal groups that you wish to trade signals from.

The additional signals groups can be entered during the initial app setup (dialogue shown below), or

by altering the TelegramBotTraderEA.ini config file with the following format:

Channel_ID: -1234567890123

Channel_ID2: -1234567890123, -1234567890123

The Channel_ID: field must contain a single channel only. Additional channels to monitor can be

entered in the Channel_ID2: field and must be separated by a comma if containing more than one

other group. The order of each group is not important, as all channels will be processed when

messages are received. Remember your own personal private chats can also be monitored, so if you

wish to send your own signals then a chat can be added to this list that only you are monitoring. This

may help automate opening orders from your own strategies while allowing the EA to manage them.

If the message format from each message group is the same then only a single EA instance will need

adding to a chart on MT4. However, in most cases the message format will vary and it will be

necessary to use separate EA settings for each signal group.

The following approach is therefore recommended:

• Setup the connector app as above and leave it running awaiting connections from the EAs.

• Add an EA instance to a chart on MT4 for each group being traded – if you are trading three

groups, add 3 EA instances to separate charts (chart symbols are not important).

• Setup the EA to take trades and manage trades according to your strategy (SL/TP, risk etc).

Each one based on the particular group it is trading.

• IMPORTANT: Set the Magic Number on each EA separately. (To ensure each EA only

manages its own trades)

• Use the following filter on each EA to ensure it only trades the group it is setup for. IDs can

be found during the initial setup or by looking at the incoming message log in the connector

Page 25: MT4 Telegram Bot Trader EA (Connector Version)

app – the message ID is shown whenever a message is received: 19:00:52 Received New

Telegram message! (Telegram ID).

The ID specified in this field must match the message group/chat ID that you wish to trade.

Other IDs received will be rejected and not processed further by the EA. To trade all groups,

leave this field empty (useful if you’re using a single EA instance only).

If a message is filtered, the connector app will show a message similar to this (the account

being used by the EA is shown to help identify the source EA if running multiple accounts on

the same machine):

Page 26: MT4 Telegram Bot Trader EA (Connector Version)

FAQ

The connector app and MT4 won’t connect.

Check to ensure the server port settings on both the MT4 EA and the connector app are the same.

The recommended setting is 51551. Ensure the MT4 EA is not set to “Money Management Mode

only”.

The TelegramBotTraderConnEA is not showing in my MT4 Navigator window.

Check that the TelegramBotTraderConn.ex4 file is installed in the EXPERTS folder of your MT4

platform and that you have restarted the platform since installation. The data folder can be opened

via the MT4 platform File menu / Open Data Folder option. If the file is not installed check that it was

installed in the correct location via the installer – you need to select the EXPERTS folder as part of the

installation process. If the default value wasn’t changed during installation the file will be in the

C:\Users\{yourusername}\AppData\Roaming\MetaQuotes\Terminal folder. Simply move it to the

EXPERTS folder and restart your MT4 platform.

I’m not receiving any confirmation messages on Telegram of trades.

Check that messages are not blocked by the settings in either the EA or the connector app. If one is

set to disable messages, none will be received. Also ensure that the return message ID is correctly

set, and that you have permission on Telegram to send to this group/channel/chat. If it’s a public

group and you are not an admin you will likely not have permission to post messages so they will be

blocked – if you wish to receive confirmation messages from trades you’ve processed in public or

subscription groups then we recommend setting up your own group in telegram to receive these

return messages – a group can be private with just the owner as a member.

I want to change the settings in the connector app.

Settings for the connector app are stored in a file called “TelegramBotTraderEA.ini” located in the

Windows AppData folder, usually:

C:\Users\{YourUsername}\AppData\Roaming\TelegramBotTraderEA. A shortcut to this file is

available in the Windows START menu TelegramBotTraderEA folder to enable easy editing:

Simply edit this file with the new information you need (or simply delete the file and launch the

connector app again and it will start the setup process). The file is just a text file that contains the

following settings:

Channel_ID: -xxxxxxxxxxxxxx

Server_Port: 51551

Page 27: MT4 Telegram Bot Trader EA (Connector Version)

Return_message_ID: xxxxxxxxxxxxxx

What files are stored on my computer?

The system only needs a few files to operate:

TelegramBotTraderEAConn.ex4 – The MT4 Expert file used on your MT4 platform

TelegramBotTraderEA.txt – This file contains details of the IDs of your groups/channels/chats to help

with the setup of the connector app. It is created during setup, but can be deleted if required after

finishing the setup process.

TelegramBotTraderEA.ini – this contains the connector settings and is required to run the connector

app. Deleting this file will cause the setup routine to run again when the connector app is next

started.

TelegramBotTraderEA.exe – the main connector app.

TelegramBotTraderEA.session – this is a file used by Telegram to authenticate the connector app and

is created during setup. If you delete this you will need to authenticate with Telegram again.

Can I receive messages from multiple groups?

Yes. Advanced licence users can benefit from trading multiple groups. Setup is complex so please

read carefully the section on trading multiple groups.

How can I uninstall the software?

We hope you won’t need to, but if you do, just use the included Windows Uninstall function – just

search “add or remove programs” from the Windows search bar and you’ll find the

TelegramBotTraderEA installation available to uninstall.

The connector app closes immediately after opening. What can I do?

This is often caused when the session file used to authenticate the connector app with the Telegram

Servers expires. Simply delete the session file:

(C:\Users\{YourUserName}\AppData\Roaming\TelegramBotTraderEA\TelegramBotTrader.session)

Then start the connector app again – you will need to authenticate the app with Telegram again, but

all other settings will remain.

©2021 https://telegramtrader.uk/