FX Blue TradeTalk for MT4 - User guide

TradeTalk sends immediate notifications by email, SMS or Twitter whenever trades are opened and closed in MT4. In effect, it adds alerting to any third-party EA without needing to modify its code. TradeTalk can also report on manual trading, and can be used to run a simple signal distribution service where you notify subscribers whenever you trade.

1Introduction

1.1Overview

This document describes the TradeTalk EA which sends messages by email, SMS, or Twitter when trades are opened or closed in MT4.

TradeTalk has two main uses:

  • You are running a signal service where clients pay you to be told when to enter and exit the market. TradeTalk sends out these notifications automatically whenever you trade in MT4.
  • You have a personal unattended copy of MT4, and you simply want to be notified whenever it trades.

Please note that SMS transmission requires an account with Clickatell or Nexmo.

1.2Licence

Unless otherwise specified in writing by FX Blue, this software is licensed for personal use only. You are not allowed to distribute it to other people, regardless of whether or not money is changing hands. You only have a licence to use the software if you, personally, downloaded it from our website.

The software is provided entirely at the user's risk, and you should check it thoroughly before deploying it on computers trading real money. FX Blue accepts no responsibility whatsoever for any loss of any kind caused by installation or use of the software.

2Installing the software

Installation of TradeTalk is fully automated by the setup program which you can download from the www.fxblue.com website. You select one or more copies of MT4, and the software is then installed.

Please note that you may need to restart MT4 in order to make the Navigator update.

After installation, the list of Expert Advisers in the Navigator should include "FX Blue - TradeTalk".

3Opening an SMS account with Clickatell or Nexmo

If you want to use TradeTalk to send SMS, then you need an account with either Nexmo (www.nexmo.com) or Clickatell (www.clickatell.com). This step can be ignored if you do not want to be able to send SMS.

Please note that the following details are subject to change if Nexmo or Clickatell alter the layout of their websites.

3.1Setting up a Nexmo account

In order to send SMS via Nexmo you need to register on their site at www.nexmo.com. You will need to provide an email address (a real one!) and a mobile phone number to receive a confirmation text. This phone number does not have to be the one which you subsequently want to send alerts to.

Once you have registered, the "Api Settings" section of the Nexmo Dashboard will show you an "API key" and "API secret" for sending texts via your account with them. You then enter these values as the SMS_param1 and SMS_param2 values in the EA's configuration.

3.1.1US and Canadian recipients

If you want to send to a US or Canadian phone number, one extra step may be required because of anti-spam regulations. You may need a "virtual number" to send from, which you enter as the SMS_param3 value in the EA. For further information, please see:

https://nexmo.zendesk.com/entries/22362928-Specific-Carrier-Restrictions-to-the-US-and-Canada-DIRECT-routes

3.2Setting up a Clickatell account

The procedure for setting up an account with Clickatell is a little complicated. The following steps could potentially change if Clickatell alter their website.

  • Create a "Clickatell Central" account at:
    https://www.clickatell.com/central/user/client/step1_new.php?prod_id=2.
  • Wait for the confirmation email to arrive, and then log in to your account at http://www.clickatell.com/login.php. Choose "Clickatell Central (API)" from the list of products.
  • Set up a connection by clicking on "Manage my products" and then choose "HTTP" from the "Add connection" list in the top-left of the page.
  • Give the connection any name you like, leave the other fields blank, and click on Submit.
  • The "Manage my products" page will refresh to show an "API code" for the connection (usually 7 digits).

You fill in your choice of username and password as the SMS_param1 and SMS_param2 values in the EA's configuration, and you fill in the "API code" as the SMS_param3 value.

3.3Testing the account details

You can test the account details using the Test SMS script which is installed with TradeTalk. You simply run the script by double-clicking on it in MT4's Navigator list, and then fill in the parameters such as SMS_param1 as described in relation to the TradeTalk SMS settings.

Parameter

Description

SMS_Carrier

See below

SMS_param1

See below

SMS_param2

See below

SMS_param3

See below

SMS_Recipients

One or more recipient phone numbers for the SMS, separated by commas. These should be in international format, e.g. 447879215460

TextToSend

The test message to send

TestAsynchronousSend

Determines whether to test synchronous or asynchronous transmission. TradeTalk using asynchronous sending.

4.1Running the monitor

You run TradeTalk by opening a new chart in MT4, and dragging the TradeTalk EA from the MT4 Navigator window onto the chart, or by double-clicking on the EA (which adds it to the active chart).

You can add TradeTalk to the chart for any symbol. By default it will send messages about all orders in MT4, regardless of symbol, not just the chart on which it is running. You do not need to run separate copies of TradeTalk on each different chart which you trade.

N.B. You must turn on "Allow DLL imports" in order to use the EA, and it will warn you if this is not switched on.

You can control the monitor's behaviour using the EA parameters described in the following sections. Please note that TradeTalk will not send order-open alerts about orders which are already open at the time the EA is started.

The EAs displays its current status in the top-left of the chart. If no status is visible, please see the troubleshooting notes below. The following screenshot shows TradeTalk running successfully:

4.2Choosing which orders to alert about

You can choose which orders are included in alerts using the following parameters. You can also specify whether alerts are issued by SMS, email, or Twitter.

The system handles pending and filled orders separately. If you turn on both AlertAboutPendingOrders and AlertAboutOpenOrders, then a first alert will be issued when a pending order is created, and a second alert will be issued when the pending order is filled (or when it is deleted without being filled).

Parameter

Description

AlertAboutOpenOrders

Sends alerts when new positions are opened

AlertAboutClosedOrders

Sends alerts when positions are closed

AlertAboutPendingOrders

Sends alerts when pending orders are created or deleted

AlertAboutPendingPriceChanges

Sends alerts if the entry price on a pending order is changed

AlertAboutSLTPChanges

Sends alerts if the s/l or t/p on an order changes - please see the notes below

IncludeSymbols

If not blank, alerts are only sent if the symbol for the trade is on this comma-separated list. This must exactly match the broker's names, including upper/lower case such as EURUSDfx,GBPUSDfx.

IncludeMagicNumbers

If not blank, a comma-separated list of EA magic numbers to include in the broadcast to subscribers. For example, 0,1234,6789 will include manual orders (which have magic number 0), plus orders from the EA(s) which use the magic numbers 1234 and 6789

NewOrder_DelaySeconds

Delay in seconds between pending or market orders being created and alerts being sent. Designed to give time to place a market order and then separately set an s/l and t/p on it before the alert is sent. If an order is both opened and closed within this delay period, no alerts are issued.

4.2.1Alerts about changes to s/l or t/p

You can use the AlertAboutSLTPChanges parameter to set up alerts when the s/l or t/p price changes on an order or position. There are three settings:

No alerts about s/l or t/p

Alert about changes from zero only

Alert about all changes to s/l or t/p

The first of these options turns off alerts about such changes. The second of them sends an alert if either the s/l or the t/p changes from zero to non-zero.

The third option sends an alert if there is any change to either the s/l or t/p. Please note that this can generate very large numbers of messages if you or your trading system is using a trailing stop.

Alerts will only be sent about the s/l or t/p on a pending order if AlertAboutPendingOrders is also turned on.

4.3Choosing how alerts are sent

You can choose how alerts are issued - by email, by SMS etc - using the following parameters. You must turn on at least one of them, and you can turn on all of them if you want to.

Some of these settings require additional information, such as the SMS account details.

Parameter

Description

SendEmail

Sends alerts by email, using the settings described below

SendSMS

Sends alerts by SMS. Requires the SMS account parameters to be filled in.

SendTweet

Sends alerts to Twitter. Requires the Twitter account details to be filled in.

SendPushNotifications

Sends alerts via the push-notification mechanism in the MT4 client terminal. You need to fill in the values in MT4's Tools / Options / Notifications

ShowPopupMessage

Shows a message in MT4's pop-up alert window. (Uses the same text which is defined for push notifications.)

4.4Alert text

The next set of parameters lets you control the text which is used for SMS and email. All these parameters can include the variables described below.

4.4.1Alerts about open positions

The following parameters are used to define the email/SMS/tweet text which is used when a new order is filled in the market. These settings are only used if AlertAboutOpenOrders is turned on.

Parameter

Description

EmailSubject_OrderOpen

Email subject line

EmailBody_OrderOpen

Email body

SMSText_OrderOpen

SMS text

TweetText_OrderOpen

Twitter status update text

Notification_OrderOpen

Text for push notification (or for pop-up alerts, if ShowPopupMessage is turned on)

4.4.2Alerts about closed positions

The following parameters are used to define the email/SMS/tweet text which is used when a position is closed. These settings are only used if AlertAboutClosedOrders is turned on.

Parameter

Description

EmailSubject_OrderClose

Email subject line

EmailBody_OrderClose

Email body

SMSText_OrderClose

SMS text

TweetText_OrderClose

Twitter status update text

Notification_OrderClose

Text for push notification (or for pop-up alerts, if ShowPopupMessage is turned on)

4.4.3Alerts about new pending orders

The following parameters are used to define the email/SMS/tweet text which is used when a new pending order is created. These settings are only used if AlertAboutPendingOrders is turned on.

Parameter

Description

EmailSubject_OrderPending

Email subject line

EmailBody_OrderPending

Email body

SMSText_OrderPending

SMS text

TweetText_OrderPending

Twitter status update text

Notification_OrderPending

Text for push notification (or for pop-up alerts, if ShowPopupMessage is turned on)

4.4.4Alerts about deleted pending orders

The following parameters are used to define the email/SMS/tweet text which is used when a pending order is deleted (i.e. removed before it is filled). These settings are only used if AlertAboutPendingOrders is turned on.

Parameter

Description

EmailSubject_OrderDeleted

Email subject line

EmailBody_OrderDeleted

Email body

SMSText_OrderDeleted

SMS text

TweetText_OrderDeleted

Twitter status update text

Notification_OrderDeleted

Text for push notification (or for pop-up alerts, if ShowPopupMessage is turned on)

4.4.5Alerts about price changes on pending orders

The following parameters are used to define the email/SMS/tweet text which is used when the entry price of a pending order is changed. These settings are only used if both AlertAboutPendingOrders and AlertAboutPendingPriceChange are turned on.

Parameter

Description

EmailSubject_OrderPriceChange

Email subject line

EmailBody_OrderPriceChange

Email body

SMSText_OrderPriceChange

SMS text

TweetText_OrderPriceChange

Twitter status update text

Notification_OrderPriceChange

Text for push notification (or for pop-up alerts, if ShowPopupMessage is turned on)

4.4.6Alerts about changes to the s/l or t/p

The following parameters are used to define the email/SMS/tweet text which is used when the s/l or t/p price changes on an order.

Parameter

Description

EmailSubject_SLTPChange

Email subject line

EmailBody_SLTPChange

Email body

SMSText_SLTPChange

SMS text

TweetText_SLTPChange

Twitter status update text

Notification_SLTPChange

Text for push notification (or for pop-up alerts, if ShowPopupMessage is turned on)

4.4.7Variables

You can use the following variables in the above text parameters. Some of the following entries are obviously only applicable to order-close messages.

Variable

Description

{ACC}

Your MT4 broker account number

{TICKET}

The ticket number of the order being opened/closed

{SYMBOL}

The symbol of the order being opened/closed

{LOTS}

The number of lots being opened/closed

{OPENORFILL}

Only applicable to messages about new open positions. Replaced with "opened" if the new position is a market order; replaced with "filled" if the new position is a fill of a previous pending order.

{OPENTIME}

The open-time of the order being opened/closed

{OPENPRICE}

The open-price of the order being opened/closed

{CLOSETIME}

The close-time of the order being closed (not applicable to open orders)

{CLOSEPRICE}

The close-price of the order being closed (this will report the current price on open orders)

{BUYSELL}

Type of order being opened/closed: buy or sell

{SL}

Stop-loss on the order being opened/closed (or zero if none)

{TP}

Take-profit on the order being opened/closed (or zero if none)

{PNLPIPS}

Profit/loss on the order being closed, in pip terms

{PNL}

Profit/loss on the order being closed, in cash terms

{SWAP}

Accumulated swap on the order being closed

{COMM}

Commission on the order being closed: a negative number for commission charged

{TOTALPNL}

Total profitability on the closed order: {PNL} plus {SWAP} plus {COMM}

{COMMENT}

Any comment on the order being opened/closed

{MAGIC}

The magic number assigned to the order being opened/closed

{LOCALTIME}

The local time according to your computer's clock

{BROKERTIME}

The latest reported broker time

{CURR}

The symbol of your deposit currency

{BALANCE}

Your current account balance

{EQUITY}

Your current account equity

{FREEMARGIN}

Your current free margin

{MARGININUSE}

Your current margin usage

{COMPANY}

Your broker's name

{TERMINALPATH}

The location of the MT4 installation, e.g. C:\Program Files\Metatrader

{CRLF}

Inserts a new line, for use in email

4.5SMS account details (Nexmo or Clickatell)

In order to send SMS from TradeTalk, you need to do three things:

Register with either Nexmo or Clickatell

Turn on the SendSMS setting

Fill in the following values about your Nexmo or Clickatell account

The meaning of the values such as SMS_param1 depends on whether you are using an account with Nexmo or with Clickatell.

Parameter

Nexmo account

Clickatell account

SMS_Carrier

Choose either Nexmo or Clickatell, depending on which you have registered with

SMS_param1

Nexmo "API key"

The username you chose when registering with Clickatell

SMS_param2

Nexmo "API secret"

The password you chose when registering with Clickatell

SMS_param3

If sending to a US or Canadian number, this needs to be a "virtual number" which you register through Nexmo. For other recipients, this is the text which you want to appear as the sender of the SMS.

The "API code" assigned after creating the HTTP "connection" within your Clickatell account

SMS_Recipients

A list of recipient phone numbers for SMS alerts, separated by commas. These should be in international format, e.g. 447879215460

Please note that TradeTalk sends its SMS asynchronously (like email in MT4), and therefore does not report on delivery problems.

All SMS activity is logged in daily files in the following Windows app-data location:

C:\Users\<your username>\AppData\Local\MT4-SMS

If any errors are reported in this log you can diagnose them using the TestSMS script.

4.6Email details

If you choose to send email alerts (by turning on the SendEmail parameter) you can either use MetaTrader 4's built-in email and its settings in Tools/Options/Email, or you can use FX Blue's email library.

The FX Blue library lets you use services such as Gmail, lets you change the sender name on messages, lets you have multiple recipients including CC and BCC addresses, and lets you send HTML-formatted email.

Parameter

Description

UseMT4EmailSettings

Determines whether to use the MT4 email settings in Tools/Options/Email. If this setting is turned on, all the following parameters for the FX Blue library are ignored

The following settings only apply if you use the FX Blue email library, i.e. if you turn off the UseMT4EmailSettings parameter.

Parameter

Description

SMTPServer

The name or IP address of your mail server (e.g. smtp.gmail.com)

SMTPPort

The port number to use on the mail server (e.g. 587 for Gmail)

SMTPUsername

Any username required by your mail server (e.g. your Google account name)

SMTPPassword

Any password required by your mail server

SMTPRequiresSSL

Whether your mail server requires a secure connection (typically yes if it is running on any port other than 25)

FromAddress

The address to send mail from. With services such as Gmail, this address must have been "verified" within the web-based service

FromName

The sender name to display

ToAddress

A comma-separated list of recipient email addresses

CCAddress

A comma-separated list of addresses to CC messages to

BCCAddress

A comma-separated list of addresses to BCC messages to

HTMLEmail

If turned on, the EmailBody_OrderOpen and EmailBody_OrderClose parameters are interpreted as HTML rather than plain text

If you use MT4's built-in email, delivery of messages is logged in the MT4 journal.

If you use the FX Blue library, messages are sent asynchronously, and all email activity is logged in the following Windows app-data location:

C:\Users\<your username>\AppData\Local\MT4-Email

4.7Twitter account details

In order to have TradeTalk send tweets, you must turn on the SendTweet parameter and also fill in the following details about your Twitter account:

Parameter

Description

Twitter_Username

Your Twitter username

Please note that Twitter uses OAuth authentication, and the process is as follows:

  • The first time that a tweet is send from TradeTalk, a window will be displayed asking you to authenticate with Twitter.
  • You click on the "Get PIN" button. This will open the Twitter website in your web browser.
  • Click on the "Allow" button on the Twitter webpage. This will display a PIN code (usually 8 digits long).
  • Copy and paste the PIN code into the authentication window (or type it in manually).
  • Click on the "Save PIN" button.
  • Your tweet will then be sent, and a success message will be displayed.

Once you have authenticated with Twitter and sent your first tweet, TradeTalk will only display messages if errors occur. It will not display further messages when tweets are successfully sent.

4.8Diagnosing problems

TradeTalk keeps a comprehensive record of its activity in the MT4 Experts log. You can view this in the Terminal pane of the MT4 software, or find the files on disk by using File / Open Data Folder in MT4 and then going to the MQL4\Logs subdirectory. (Please note that the Logs subdirectory is different to MQL4\Logs; the former contains the MT4 Journal.)

As explained above, SMS activity is recorded in a separate place because it is sent asynchronously. Email activity is also recorded in a separate place if you are using the FX Blue email library rather than MT4's built-in email.

 
Continue to site >