Dark Mode
Thursday, 27 March 2025
BUY% SEL%L ALERT MOD
BUY% SEL%L ALERT MOD

BUY% SEL%L ALERT MOD

Watch the testing video here:

BUY%-SEL%L_ALERT_MOD

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, Stochastic 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:

 

  • As 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 Play Sound).

 

Besides, there are functions for sending a file to the FTP server (function SendFTP ()), displaying a message/dialog box (Message Box ()), and sending mails (Send Mail ()). Function SendFTP () will hardly be demanded by a regular user, function Message Box () does not suit for being used in an indicator since it stops its operation until the message box is closed, function Send Mail (), 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.

 

One of the most convenient and the simplest of them is function Alert since it contains both text and sound. Besides, the terminal stores the Alerts history, so it is possible to see what signal came an hour ago.

 

But tastes differ, it's a common knowledge. So I will make something like a preform for all the above-mentioned methods (except for SendFTP, Message Box, Send Mail), and you will just choose a suitable one.

 

ALERT FREQUENCY FILTER

If you have ever used alerts in indicators, you certainly had to deal with their over frequency, especially on smaller timeframes. There are some ways to solve this problem:

 

  • To define alerts on bars already formed. This solution would be the most proper.
  • Alternate alerts - sell after buy and vice versa (it would be a very logical way, too, that can be used together with other ones).
  • Make a pause between alerts (not a good idea).
  • Give only one alert per bar (this limitation is rather affected limitation).

 

Whether to use alerts from a zero, not yet formed bar, is everyone's personal business. I, for instance, suppose this to be wrong. But there are indicators that need instant response - one bar is too much for them. So we will allow users to make their choice. Several alerts to buy would hardly have any sense, so we will alternate all alerts. We will not introduce any artificial pauses I suppose. If they are really necessary, this fact will be known from comments to this article.

Thus, let us start realization.

Alert One - Intersection of Two Lines of an Indicator

Let us start with the MACD that has been given in examples above.

Our main task is to detect in what arrays the indicator lines are stored.

Share this on:


Login