[MT4][Free] EA that notifies LINE etc. of position information and specified value arrival information

We think that there are many people who are using MT4 and are using automation and trails in EA etc.
Have you ever wanted to be notified via LINE that EA will automatically acquire and settle positions?

Here, we would like to introduce an EA that notifies such people of the following information to LINE and e-mail.(Free / no ad notifications)
※Due to the API used to notify LINE of information, it cannot be realized with Indicator, so it is implemented in EA.

NOTE:Please note that it is prohibited to redistribute the EA / Indicator published on this site without permission.(There is no problem with linking to this site)

Contents

1. List of Functions

You can notify the “Information Type” to the “Notification Destination” described below.

1-1. Notification destination:

  1. LINE
  2. e-mail
    ※Others such as Facebook messenger and WhatsApp may be expanded in the future.

1-2. Information Type:

  1. Position Open / Close information
    1. The information to be notified is as follows
      1. Open information
        1. Open time
        2. Currency pair of opened positions
        3. Order type of opened position (BUY / SELL)
        4. Price of opened position
        5. Lots number of opened positions
      2. Close information
        1. Close time
        2. Currency pair of closed position
        3. Order type of closed position (BUY / SELL)
        4. Price of closed position
        5. Lots number of closed position
        6. Take Profit value
  2. Notification when the specified value of the specified currency pair is reached
    1. Two values can be specified
    2. The information to be notified is as follows
      1. Designated currency pair
      2. Specified value
      3. Time when the specified value is reached (basic 1 minute unit)
      4. Open value (1 minute information of the time in 3.)
      5. High value(same as above)
      6. Low value(same as above)
      7. Close value(same as above)
    3. Notification Mode
      1. Only the first time the specified value is reached
      2. Every time the specified value is reached
  3. Notification when the RSI specified value of the specified currency pair is reached
    1. Two values can be specified
    1. How many minutes of RSI can be set
    2. The information to be notified is as follows
      1. Setting currency pair
      2. RSI Setting value
      3. Time when the RSI set value is reached (basic 1 minute unit)
      4. RSI value
    3. Notification Mode
      1. Only the first time the specified value is reached
      2. Every time the specified value is reached

1-3. Notification cycle(Condition match check cycle):

The notification cycle is fixed at 1 minute.
It is designed to check whether it matches the conditions set in this EA at 1-minute intervals and notify you when the conditions are met.

2. how to use

2-1. Advance preparation

Advance preparation is required to notify LINE and e-mail.
If you use only LINE notifications, please use only LINE notification settings. If you use only e-mai notifications, please use e-mail only. If you use both, please prepare in advance.

2-1-1. Notification to LINE Advance preparation

To notify LINE, use the official LINE “LINE Notify“.
An access token is required for notifications, so please refer to Qiita’s [超簡単]LINE notify を使ってみる to get it.

The remarks when acquiring an access token are as follows.

Token name:Anything will be fine.(In the TOP image of this site, it is an example when “MT4” is set.)

Talk room to send notifications:It can be in the talk room, or you can set it for yourself.

Make a note of the issued token somewhere.
Set this token when setting up the EA.

Once you get the access token, the next step is to set up MT4.
When making LINE notifications, we use an API called WebRequest in MT4, but it is necessary to set the API to allow notifications to LINE Notify.

Open “Tools”-> “Options” of MT4 and open “Expert Advisor” tab.
In the setting screen, check “URL list that allows WebRequest:”, add “https://notify-api.line.me/api/notify” as shown below, and click OK.

WebRequest setting

That’s all the preparation required for LINE notifications.

2-1-2. Notification to e-mail Advance preparation

Before you can send e-mail from EA, you need to set MT4 E-Mail.

First, open the options screen by selecting “Tools”-> “Options”.

After opening the options screen, open the Email tab.
On this screen, check “Enable” and set the sending address and server information, and the e-mail address you want to receive notifications by e-mail.
You can send a test by pressing the “Test” button to see if the settings are correct.

After completing the settings, press the OK button and let MT4 remember the settings.

2-2. EA download

download the EA from the following.

download link for LU_NotifyPosInfo.ex4 is here.

2-3. Add EA to Chart

Add the downloaded EA to MT4.
The Chart that adds the EA can be anything.
This EA works by referring to the transaction information on the “Trade” tab and “Account History” tab of MT4, so even if you add it to the Chart of any currency pair, it will be applied to all currency pairs of the logged-in account. In response, notification processing is performed.
For how to add EA, please refer to How to add EA to MT4 and add EA to Chart.

2-4. EA settings

When adding an EA to the Chart, set the information required for notification in “parameters”.
The settings are roughly divided into the following three types.
A : Notification settings (ON / OFF of notifications and information settings required for notifications)
B : ON / OFF setting for position Open / Close notification
C : Specified value arrival notification setting
D : RSI value arrival notification setting

Parameters for EA Page 1
Parameters for EA Page 2

Each setting is explained below.

2-4-1. Notification settings (A settings)

First of all, about the setting of orange A in the above image.

IsNotifyInfo :
Setting whether to notify to the outside (LINE or e-mail).Set true if you want to be notified, and set false if you do not want to be notified.
※If false is set, the B and C settings will also be invalid.

notifyTo :
Set the notification destination.
Select LINE or e-mail as the notification destination.
Information will be sent to the selected notification destination.

AccessToken :
If notification to LINE is set, please set the access token obtained by LINE notify mentioned above here.

2-4-2. Open / Close position notification settings (B settings)

Next, about the setting corresponding to the green B in the above image.

posNotifyType :
It is a setting whether to notify the Open / Close information of the position.
The meaning of the setting value is as follows.

POS_NOTIFY:Enable notifications.
NONE:Disable notifications.

2-4-3. Specified value arrival notification setting (C setting)

Next, about the setting corresponding to the blue C in the above image.

alarmNotifyType :
It is a setting whether to notify when the specified value is reached.
The meaning of the setting value is as follows.

ALARM_ONCE:When the specified value is reached, the notification will be sent only once for the first time.

ALARM_LOOP:The notification is repeated each time the specified value is set.

NONE: Do not notify



※If you want to select ALARM_ONCE and notify again with the same settings, right-click on the Chart to which this EA is added, open “Expert Advisor” → “Settings”, leave the settings as they are, and click the “OK” button again. If you press, you will receive the notification only once again.

Symbol1 :
Specify the currency pair name to set the first specified value.
Please set the currency pair name of tab displayed below when chat is displayed on MT4.
If you leave it blank, the first notification setting will be invalid and you will not receive the notification.

例:For EURUSD on the OANDA Tokyo server, set “USDJPY.oj5k”.

AlarmValue1 :
Set the first specified value.
Specify which value of the currency pair specified by Symbol1 to notify.
If you set 0, the first notification setting will be invalid and you will not receive the notification.

Symbol2 :
For the second notification setting, the content is the same as Symbol1.

AlarmValue2 :
It is for the second notification setting and the content is the same as AlarmValue1.

2-4-4. RSI notification settings (D settings)

Finally, about the setting corresponding to the red D in the above image.
If you don’t understand the explanation below, please take a look at the specifications of mql4.
(Since some Parameters use the IF of iRSI as it is.)

rsiNotifyType :
Set whether to notify when the RSI value reaches the specified value.
The meaning of the setting value is as follows.
RSI_LOOP :will be notified every time the specified RSI value is reached.
RSI_ONCE :When the specified RSI value is reached, the first notification is sent only once.
NONE :Does not notify by RSI value.

rsiTimeFrame :
Set the time cycle for calculating RSI.
The setting can be selected from 1 minute to 1 month.
Notifications are also checked for conditions in this cycle, and notifications are sent when the conditions are met.

rsiAveragePeriod :
Sets the average period for RSI calculations.

rsiAppridePrice :
Sets the timing of the values for which the RSI is calculated.
The value that can be set can be the ID described in ENUM_APPRIDE_PRICE defined in mql4.

rsiSymbol :
Set the currency pair for which the RSI is calculated.
Set the currency pair name of tab displayed below when chart is displayed in MT4.
If you leave it blank, the first notification setting will be invalid and you will not receive the notification.

Example: For USDJPY on the OANDA Tokyo server, set “USDJPY.oj5k”.

rsiNotifyHighValue :
Set the first value of the RSI you want to notify.
If you set it to 0, you will not receive any notifications regarding this setting.

rsiNotifyLowValue :
Set the second value of the RSI you want to be notified of.
If you set it to 0, you will not receive any notifications regarding this setting.

This completes the settings.

Notification example:
Left: Notification to LINE
Right: Notification to e-mail


If you have any comments, please feel free to contact us below.
Twitter : @takeru_ma202012