Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2013.12.16 07:23
Indicators

Alerts on New Bar - indicator for MetaTrader 4

| English Español Português 日本語 Deutsch

Views:
20352
Rating:
votes: 6

Indicator: Alerts on New Bar

  • Please read all relevant Information.
  • Other than the below notes the Author cannot respond to individual inquiry. The user will find abundant help and advice on the internet - MetaQuotes, Forums, Search Engines, Video Sites etc.

Alert Options:

  1. Popup Alert
  2. Sound
  3. Email
  4. Push Notification
  • If the Popup Alert and Sound Alert are both set to true only the Popup Alert will function. For the Sound Alert to work the Popup Alert must be set to false. This is a MT4 function.
  • Any Alert set to true will fire it the chart Period (Timeframe) is changed. The same applied if MT4 is loaded and Alerts are set to true. I have not solved these problems (see here - posts #943,#944) and nor have I seen them solved for New Bar Alerts.
  • All Alerts will state Broker Time and Date.
  • New Bar Alerts can also work with most Renko and Constant Range (Synthetic) candles.

Sound (applicable only if extra sound alerts wanted)

  1. The Indicator default sound alert is "alert.wav" and corresponds to options 1 of the Indicator Sound_Bite parameter. "alert.wav is a MT4 default sound file. The sound file associated with option 1 cannot be changed unless recoded.
  2. The Sound_Bite parameter has additional sound options 2, 3, 4, 5, 6, 7, 8 but no associated sound bite files.The user must add these files to the MT4/Sounds folder. This is optional not a must do.
  3. An example sound bite is provided in SB2.zip (see Download). Place this unzipped sound bite - SB2.wav - in the MT4/Sounds folder and it will correspond to option 2 of the Indicator Sound_Bite parameter.
  4. Fee additional sound bites can be got - HERE. Hint - search for "chimes", "bells" etc.
  5. Additional sound bite files must be in .wav format and renamed SB2.wav, SB3.wav,SB4.wav, SB5.wav, SB6.wav, SB7.wav or SB8.wav; placed in the MT4/ Sounds folder; they will correspond to to options 2, 3, 4, 5, 6, 7, 8 of the Indicator Sound_Bite parameter. Options not required do not need associated sound files.
  6. Sound files not in .wav format must be converted to .wav format with an audio converter and named in accordance with the above directives.
  7. Other than Alert sounds, Event sounds can be changed from Tools → Options → Event.

Push Notification: (iOS and Android)

  1. Push Notifications are fast, fail safe and easy to set up.
  2. Speed will depend on capability of Internet Connection and Computer and Mobile Devices.
  3. First install MT4 on Mobile Device.
  4. Locate MetaQuotes ID. See - Messages or Messages in Settings
  5. Enter MetaQuotes ID in Client Terminal of MT4 on computer (Tools → Options → Notifications).
  6. Note: The same MetaQuotes ID can be used with multiple Client Terminals (different Brokers).
  7. Click the Test Button.
  8. Open up MT4 Terminal (Ctrl + T) and select the Journal Tab and check under Messages if the the Test was successful.
  9. One a successful Test is obtained Push Notification Alerts can be set in the Alerts New Bar Indicator.
  10. Important: Ensure that your mobile device has sound turned on for notifications.
  11. If further clarification is required, google and youtube "MT4 push notification."


Below: Two Push Notifications as received on Android Mobile Device. Each from different Brokers using the same MetaQuotes ID.

The image below shows time displayed as hh:mm. The user code will display time as hh:mm:ss.

The Broker time is one hour ahead of local time.


Below: Push Notifications receive on iOS Mobile Device.

The image below shows time displayed as hh:mm. The user code will display time as hh:mm:ss.

The Broker time is one hour ahead of local time. PN delivery is, depending on equipment capability, instantaneous or within a few seconds. The two minute (on hour) time difference is delay in taking screen shot.


Email

  • There are a number of ways to setup MT4 Email and the user should research the Internet for clarification.
  • I have successfully set up Email with stunnel and hMailServer. Both are FREE.
  • Here is how to do it with stunnel.
  1. Go to his forum for further clarification.
  2. First download the stunnel install file. If the following link is out of date or broken search the internet for a new stunnel download link. Stunnel Download.
  3. Install stunnel. Note: During the the installation a black cmd screen opened requesting location information. I did not type in any information and merely pressed the Enter Key at every request untill the cmd screen closed.
  4. After installation a stunnel icon should be on the desktop. Click on the trunnel icon and open the stunnel configuration file. It should open in NotePad. Edit the stunnel.conf file in accordance with the above referenced Forum instructions. A copy of my edited file (stunnel.conf), current at Dec 2013, can be found in Stunnel Config.zip. See - Download.
  5. Fill Server and Email information in the MT4 Terminal (Tools → Options → Email).
  6. Note: stunnel must be running for the Indicator Email function to work - check if stunnel icon is on the task bar.To automate every time the computer turns off just create a shortcut of RUN STUNNEL then paste this shortcut into the STARTUP folder.
  7. Click the Test Button.
  8. Open up MT4 Terminal (Ctrl + T) and select the Journal Tab and check under Messages if the the Test was successful.
  9. Once a successful Test is obtained Email Alerts can be set in the Alerts New Bar Indicator.

Note: I filled in SMTP sever as 127.0.01:25 as suggested by Sangmane in the above referenced forum because smtp.gmail.com:25 did not work for me.

I used the same email address for SMTP login, From and To. Different Email addresses can be used for From and To. I would deem SMTP login and From would have to be the same Email address but I have not tested to prove certainty.


Below: Email as received in Email Client. (Desktop, Laptop and Mobile Devices).

The image below shows time displayed as hh:mm. The user code will display time as hh:mm:ss.


New Bar Alert Label

  1. The New Bar Alert Label indicates Alerts set to true. The below image indicates Popup Alert, Email Alert and Push Notification set to true.
  2. The New Bar Alert Label font is at default Bold. Bold can be turned off. See Parameters: Font_Bold - true/false.
  3. The New Bar Alert Label can be hidden. See Parameters: Show Font - true/false.


Alert Truth Table

  1. The indicator has 4 different Alerts, each Alert has two states - true or false. The total possible combinations of Alerts are 16. (2 to exponent 4 or 2 x 2 x 2 x 2)
  2. When Popup Alert and Sound Alert are simultaneously true only Popup Alert is functional. This result in a loss 4 unique combinations leaving 12 combinations out of 16.
  3. This can be seen under columns Logical Output-2 and Modified Output where S is effectively cancelled in rows 1, 2, 3 and 4 due to the coexistence of A (Popup Alert) and S(SoundAlert) both in state of T(true). See explanation under heading Sound.
  4. The above results in column Modified Output rows 1, 2, 3 and 4 being duplications of rows 5, 6, 7 and 8 respectively.

Key:

  • T: True
  • F: False
  • A: Popup Alert
  • S: Sound Alert
  • M: Email Alert
  • P: Push Notification

12 Alert combinations: AMP, AM, AP, A, SMP, SM, SP, S, MP, M, P & no Alerts.

Logical Input-1
Logical Input-2 Logical Input-3 Logical Input-4
Logical Output-1 Logical Output-2
Logical Output-3
Logical Output-4

Modified Output

A
S
M
P

A
S
M
P

A - S - M - P
1
T
T
T
T
1
A
S cancelled
M
P
1
AMP
2
T
T
T
F
2
A
S cancelled M

2
AM
3
T
T
F
T
3
A
S cancelled
P
3
AP
4
T
T
F
F
4
A
S cancelled

4
A
5
T
F
T
T
5
A

M
P
5
AMP
6
T
F
T
F
6
A

M

6
AM
7
T
F
F
T
7
A


P
7
AP
8
T
F
F
F
8
A



8
A
9
F
T
T
T
9

S
M
P
9
SMP
10
F
T
T
F
10

S
M

10
SM
11
F
T
F
T
11

S

P
11
SP
12
F
T
F
F
12

S


12
S
13
F
F
T
T
13


M
P
13
MP
14
F
F
T
F
14


M

14
M
15
F
F
F
T
15



P
15
P
16
F
F
F
F
16




16


Parameters

  • Popup_Alert - false;
  • Sound_Alert - false;
  • Email_Alert - false;
  • Push_Notification - false;
  • Sound_Bite - 1;
  • New_Bar_Label - "NB Alert";
  • Font_Color - DodgerBlue;
  • Font_Size - 11;
  • Font_Bold - true;
  • Show_Font - true;
  • Left_Right - 25;
  • Up_Down - 100;
  • Corner - 1;

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

Average Directional Movement Index (ADX) Average Directional Movement Index (ADX)

The Average Directional Movement Index Indicator (ADX) helps to determine if there is a price trend.

Holt's double exponential smoothing trend Holt's double exponential smoothing trend

Holt's double exponential smoothing - the trend component (mt4 version).

Holt's double exponential smoothing (mt4 version) Holt's double exponential smoothing (mt4 version)

Holt's double exponential smoothing with linear forecasting.