News Alert Lag_v1

Download script
Author: Jo�o Barbosa
News Alert Lag_v1

This script is designed as a real-time monitoring tool for MetaTrader users who want to stay informed about sudden, significant market shifts. Its primary goal is to act as an early warning system by detecting spikes in trading costs—specifically "Spread" and "Stop Levels"—which are often the first indicators of high-impact economic news or extreme market volatility.

How it Works

When you load this tool on your chart, it performs a two-step analysis:

1. Establishing a Baseline The moment the script is activated, it takes a "snapshot" of the current trading conditions for the specific currency pair you are viewing. It records what the standard spread (the difference between the buy and sell price) and the standard stop level (the minimum distance required to place a pending order) look like during normal market conditions.

2. Continuous Monitoring Once the baseline is set, the script constantly scans the live market. It compares the current trading environment against those initial "normal" figures.

3. Triggering Alerts The script is programmed to notify you if the market undergoes a sudden change that exceeds a pre-defined tolerance level. Specifically:

  • Spread Monitoring: If the difference between the buy and sell price widens significantly beyond the normal range (plus a small buffer called "Lag"), the tool will trigger an immediate alert on your screen.
  • Stop Level Monitoring: If the platform's requirements for placing orders increase suddenly, it will also trigger an alert.

Key Benefits for Traders

Instead of constantly staring at the ticker, this tool automates the detection of "slippage" risks. When a major news event breaks, liquidity often dries up and spreads widen instantly; this script detects that jump in real-time, providing you with a visual and audio notification to help you decide whether to stay out of the market or adjust your trading strategy accordingly.

Miscellaneous
It issuies visual alerts to the screen
14 Views
0 Downloads
0 Favorites
News Alert Lag_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;
extern int Lag=2;

//+------------------------------------------------------------------+
//| 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+1>NormalSpread+Lag) { Alert("News or High Volatility !!! Spread has change.");
                                    Print("Actual Spread: ",ActualSpread," Pips, Normal Spread: ",NormalSpread," Pips"); }
   if (ActualStopLevel>NormalStopLevel) { Alert("News or High Volatility !!! Stop Level has change.");
                                          Print("Actual Stop Level: ",ActualStopLevel," Pips, Normal Stop Level: ",NormalStopLevel," Pips"); }

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

Comments