Spread Alert_v1

Download script
Author: Jo�o Barbosa
Spread Alert_v1

This tool is designed to act as a real-time monitoring system for traders who need to stay informed about fluctuations in market liquidity and execution constraints. Its primary purpose is to provide instant notifications whenever there are significant shifts in the "Spread" or the "Stop Level" of a specific trading asset.

How it Works

Initial Setup When you first load the tool onto your chart, it performs a baseline scan of the current market conditions. It identifies and remembers two key pieces of data:

  1. The Normal Spread: The typical difference between the buying price and the selling price at the moment of activation.
  2. The Normal Stop Level: The standard minimum distance required by the broker to place pending orders.

Continuous Monitoring Once active, the script constantly "listens" to the market feed. It refreshes the data every half-second to ensure it is capturing the most current information available from your broker.

Alert Triggers The logic follows a simple "comparison" rule. Every time the market updates, the tool compares the live numbers against the baseline it recorded at the start:

  • Spread Changes: If the gap between the buy and sell price moves significantly away from the initial value, the system will trigger an alert. It will notify you of the current pip count and remind you what the "normal" level was supposed to be.
  • Stop Level Changes: Similarly, if the broker changes the rules regarding how close you can place your stop-loss or take-profit orders, the tool detects this change immediately. It will alert you that the new limit has been reached compared to the original setting.

Summary for the User

Think of this script as a "sentinel." Instead of you having to manually watch the ticker tape for tiny movements in transaction costs or order restrictions, the script does it for you. You will only be interrupted by a notification when something actually changes, allowing you to react quickly to volatile market conditions or unexpected broker updates.

Miscellaneous
It issuies visual alerts to the screen
9 Views
0 Downloads
0 Favorites
Spread Alert_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                 Spread Alert.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,LastSpread,LastStopLevel;

int init()
  {
   NormalSpread=MarketInfo(Symbol(),MODE_SPREAD);
   NormalStopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
   LastSpread=NormalSpread;LastStopLevel=NormalStopLevel;
   return(0);
  }

int start()
  { 
   RefreshRates();Sleep(500);
   int ActualSpread=MathMax((Ask-Bid)/Point,NormalSpread);
   int ActualStopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
   if (ActualSpread!=LastSpread) {
     Alert(Symbol()," - Spread has change to ",ActualSpread," pips. Normal is ",NormalSpread," pips.");Sleep(500);
     LastSpread=ActualSpread; }
   if (ActualStopLevel!=NormalStopLevel) {
     Alert(Symbol()," - Stop Level has change to ",ActualStopLevel," pips. Normal is ",NormalStopLevel," pips.");Sleep(500);
     LastSpread=ActualSpread; }
   return(0);
  }

Comments