xr86yp295m Forex Leader: 06/20/09

Adding sound alerts

June 20, 2009

Here is an interesting article I stumbled upon today about how to implement various types of alerts in to your indicators or EAs. This is for the ones who like to fiddle with programs ;-)

Sound Alerts in Indicators

Introduction

Though automated trading becomes more and more popular, many traders still practice manual trading. So, where an Expert Advisor needs some milliseconds to evaluate the current market situation, a human will spend much time, power and - which is most important - attention.

As a couple of years before, many traders use one or more Technical Indicators. Some strategies consider indicator values on several timeframes simultaneously.

So, how can one "catch" an important signal? There are several choices:

write an Expert Advisor that would analyze the market and alert about important events;
sit in front of the monitor and , switching between tens of charts, try to analyze the information from all of them;
add an alerting system into all indicators used.
The first choice is, in my opinion, the most proper. But it demands either programming skills or money to pay for realization. The second way is very time consuming, tiring, and inefficient. The third choice is a cross between the former two ways. One needs much fewer skills and less time to implement it, but it can really better the lot of the user trading manually.

It is the implementation of the third choice that the article is devoted to. After having read it, every trader will be able to add convenient alerts into indicators.

Types of Alerts

There are many ways to interpret indicators. People can differently understand the meaning of even MetaTrader 4 Client Terminal indicators, not to say about various custom indicators...

Somebody buys when the main line of MACD touches the signal line, another trader waits until it intersects the zero line, and somebody opens a long position when MACD is below 0 and starts moving up. I don't feel myself able to count all possible interpreting variations, so I will just describe the principles of how an alerting block can be added into an indicator. Then you will be able to add any kind of alerts into practically all indicators according to your taste.

The most possible alerts are listed below:

intersection of two lines of an indicator (lie in the example above - the main and the signal line of MACD);
intersection of the indicator line and a certain level (for example, the main line of MACD and zero line, Stoсhastic and levels of 70 and 30, CCI and levels of -100 and 100);
reversed moving of the indicator (for example, AC and AO, normal MA);
changed location towards price (Parabolic SAR);
appearing arrow above or below the price value (Fractals).

There are probably some other interpretations that are forgotten or even not known to me, so we will describe the five ones listed above.

Ways of Alerting

MetaTrader 4 and MQL4 allow implementation of several ways of both visual and audio alerting:

a usual screen message (function Comment);
a records in the log (function Print);
a message window plus a sound (function Alert);
a special sound, a file to be selected and played (function PlaySound).
Besides, there are functions for sending a file to the FTP server (function SendFTP()), displaying a message/dialog box (MessageBox()), and sending mails (SendMail()). Function SendFTP() will hardly be demanded by a regular user, function MessageBox() does not suit for being used in an indicator since it stops its operation until the message box is closed, function SendMail(), though it is good for sending SMS, is rather "dangerous" in use - having drawn a number of indicators in a chart, you will provide yourselves with an endless and uncontrolled stream of messages. The function may be used, but it would be better to use if from an EA, for instance, by sending a message when an alert occurs on several indicators simultaneously, paying much attention to it.

In this article, we will consider only audio and visual ways of alerting in the MetaTrader 4 Client Terminal.

Go here for the rest of the article:

http://articles.mql4.com/374/