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