Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Indicator | TrendLineAlert_V2

The indicator displays a sloping trend line. Its parameters are set when the indicator is launched by a trader. The trend line defines the signal trigger level. The line breakthrough activates signals accompanied by emails and push notifications.

During the first launch, the line that sets the trigger level is colored gray and remains inactive.

MetaTrader Experts, Indicators, Scripts and Libraries

Fig. 1. TrendLineAlert_V2 indicator. Inactive trend line

When a trader changes the line position on the chart, it becomes active and changes its color to red.

MetaTrader Experts, Indicators, Scripts and Libraries

Fig. 2. TrendLineAlert_V2 indicator. Active trend line

As soon as the price reaches the trigger line, the indicator activates alerts or audio signals.

MetaTrader Experts, Indicators, Scripts and Libraries

Fig. 3. TrendLineAlert_V2 indicator. Activating an alert

The indicator provides signals at each tick, during which the line remains broken till the signal limit is reached. The limit is specified by the AlertTotal external variable (number of signals) in the indicator settings. After that, the trigger line is colored gray and becomes inactive until moved to required levels by a trader with the corresponding color change.

//+------------------------------------------------+  //| Indicator inputs                               |  //+------------------------------------------------+  input string level_name="Trend_Level_1";                            //trigger level name  input string level_comment="trend trigger level";                   //trigger level comment  input color active_level_color=clrRed;                              //activated level color  input color inactive_level_color=clrGray;                           //triggered level color  input ENUM_LINE_STYLE level_style=STYLE_SOLID;                      //trigger level style  input ENUM_WIDTH level_width=w_3;                                   //trigger level width  input bool AlertON=true;                                            //Allow alerts  input uint AlertTotal=3;                                            //number of signals  input bool EMailON=false;                                           //Allow emails  input bool PushON=false;                                            //Allow push notifications  input bool Deletelevel=true;                                        //remove level settings when changing timeframe 
22583