News Alert Lag

Download script
Author: Jo�o Barbosa
News Alert Lag

This tool is designed to act as a real-time market monitor that alerts you to sudden shifts in trading conditions, specifically those caused by major news events or periods of extreme market volatility. Instead of analyzing price charts or complex patterns, it focuses on the underlying infrastructure of the market—specifically "Spread" and "Stop Levels."

How It Works

The script establishes a baseline for your current trading pair by recording the "normal" market conditions as soon as you load it onto your chart. It then constantly monitors these two key factors:

1. Spread Monitoring The "spread" is the difference between the price at which you can buy and sell an asset. In normal markets, this gap stays relatively stable. During high-impact news events, liquidity often drops, causing this gap to widen significantly. The script detects if this gap expands beyond a pre-set threshold (your chosen "Lag" buffer) and immediately notifies you.

2. Stop Level Monitoring The "Stop Level" is a limit set by the broker that determines the minimum distance you must place your stop-loss orders from the current price. Brokers often increase this limit during times of high volatility to protect against rapid price swings. The script monitors for these sudden increases, alerting you if the broker restricts your ability to place closer stops than usual.

Key Features

  • Real-Time Alerts: When the market experiences a sudden surge in volatility or news-driven instability, the script triggers an instant audible and visual alert on your screen.
  • Volatility Detection: It serves as an early warning system, letting you know when the market environment has become "unstable" before you might notice it on a standard price candle.
  • Data Logging: In addition to the alerts, the script records the specific numbers (the actual vs. normal figures) in your trading terminal's log, allowing you to review exactly how much the market shifted during the event.

Summary for Traders

This script is essentially an automated "safety watch." It doesn't tell you which direction to trade; rather, it watches the plumbing of the market to warn you when conditions become too volatile or erratic for standard trading activities, helping you stay informed during high-pressure news releases.

Miscellaneous
It issuies visual alerts to the screen
11 Views
0 Downloads
0 Favorites
News Alert Lag
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                 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