Author: Kalenzo
Alert_BB

This tool is designed to monitor live market price movements and provide real-time notifications whenever the current price enters specific zones defined by the Bollinger Bands technical indicator. Instead of requiring you to watch charts constantly, the script automatically detects when the market "touches" key levels and alerts you immediately.

How the Logic Works

The script operates by calculating three distinct price levels based on the Bollinger Band indicator:

  1. The Upper Band (PLUS DI): This represents the upper boundary of the current market volatility.
  2. The Middle Band (MID): This represents the moving average or the "center" of the price action.
  3. The Lower Band (MINUS DI): This represents the lower boundary of the market volatility.

The Alert Mechanism

The system constantly checks the current live bid price against these three levels. It uses a customizable "range" setting to create a small buffer zone around each band. This ensures that the alert is triggered not just when the price hits an exact decimal point, but when it enters the immediate vicinity of the target line.

Notification Flow

The script follows a prioritized check sequence:

  • First, it checks if the price has entered the Upper Band zone. If it has, it triggers an alert specifying that the "PLUS DI" range has been reached.
  • If the price is not at the upper band, it then checks if the price has reached the Middle Band. If so, it alerts you that the "MID" range has been reached.
  • Finally, if neither of the above conditions are met, it checks for the Lower Band. If the price hits this area, it alerts you that the "MINUS DI" range has been reached.

In summary, this script acts as an automated watchdog. It monitors the relationship between the current market price and three critical volatility boundaries, sending you a notification the moment the price crosses into any of those designated territories.

Indicators Used
Bollinger bands indicator
Miscellaneous
It issuies visual alerts to the screen
15 Views
1 Downloads
0 Favorites
Alert_BB
//+------------------------------------------------------------------+
//|                                                     Alert_BB.mq4 |
//|                                                          Kalenzo |
//|                                      bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "bartlomiej.gorski@gmail.com"
extern int range = 1;
extern int period = 20;
extern int deviation = 2;
extern int bands_shift = 0;
extern int applied_price = PRICE_CLOSE;
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    
//----bb
   double bbP = iBands(Symbol(),0,period,deviation,bands_shift,applied_price,MODE_PLUSDI,0);
   double bbMid = iBands(Symbol(),0,period,deviation,bands_shift,applied_price,MODE_MAIN,0);
   double bbM = iBands(Symbol(),0,period,deviation,bands_shift,applied_price,MODE_MINUSDI,0);
   
   if( (Bid <= bbP+(range*Point)) && (Bid >= bbP-(range*Point)))
   Alert(Symbol()+" Bolinger PLUS DI range reached at ",Bid);
   else if( (Bid <= bbMid+(range*Point)) && (Bid >= bbMid-(range*Point)))
   Alert(Symbol()+" Bolinger MID range reached at ",Bid);
   else if( (Bid <= bbM+(range*Point)) && (Bid >= bbM-(range*Point)))
   Alert(Symbol()+" Bolinger MINUS DI range reached at ",Bid);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments