News Alert 2_v1

Download script
Author: Jo�o Barbosa
News Alert 2_v1

This tool is designed to act as an automated market monitor that alerts you to sudden, significant shifts in trading conditions—specifically those caused by high-impact news events or extreme market volatility.

Instead of manually watching every price fluctuation, the script works by establishing a "baseline" for your current trading instrument. When you first load the tool, it captures two vital pieces of information from the market:

  1. The Standard Spread: The typical difference between the buy and sell prices.
  2. The Standard Stop Level: The minimum distance required to place pending orders.

Once these baseline values are set, the script continuously monitors the live market in real-time. It compares the current, live conditions against those initial baselines. If it detects that either the spread or the stop level has increased beyond your established norms, it triggers an immediate alert on your screen.

Key Features of the Logic:

  • Volatility Detection: By monitoring the "Spread," the tool identifies when liquidity drops or demand spikes—common during major economic announcements.
  • Execution Protection: By monitoring the "Stop Level," the tool warns you when the market becomes too unstable to place new orders at close proximity to the current price.
  • Automated Notifications: When a discrepancy is found, the tool provides a visual and audible alert, along with a detailed log entry showing exactly how many pips the market has shifted compared to the normal state.
  • Cool-down Period: To prevent your screen from being flooded with repeated notifications during a single volatile event, the script includes a built-in pause after an alert is triggered, allowing you time to assess the situation before it continues monitoring.
Miscellaneous
It issuies visual alerts to the screen
11 Views
0 Downloads
0 Favorites
News Alert 2_v1
//+------------------------------------------------------------------+
//|                                                 News Alert 2.mq4 |
//|                                                     João Barbosa |
//|                                        obarbosa2001@yahoo.com.br |
//+------------------------------------------------------------------+
#property copyright "João Barbosa"
#property link      "obarbosa2001@yahoo.com.br"

#property indicator_chart_window

int NormalSpread, NormalStopLevel;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   NormalSpread=MarketInfo(Symbol(),MODE_SPREAD);
   NormalStopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
   start();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  { 
   RefreshRates();
   int ActualSpread=(Ask-Bid)/Point;
   int ActualStopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
   if (ActualSpread>NormalSpread) { Alert("News or High Volatility !!! Spread has change.");
                                    Print("Actual Spread: ",ActualSpread," Pips, Normal Spread: ",NormalSpread," Pips"); 
                                    Sleep(50000);}
   if (ActualStopLevel>NormalStopLevel) { Alert("News or High Volatility !!! Stop Level has change.");
                                          Print("Actual Stop Level: ",ActualStopLevel," Pips, Normal Stop Level: ",NormalStopLevel," Pips");
                                          Sleep(50000); }

   return(0);
  }
//+------------------------------------------------------------------+

Comments