//+------------------------------------------------------------------+
//|                                                  SpreadMoniter   |
//|                                                   Lowphat © 2006 |
//|                                        Format hijacked from cja  |
//+------------------------------------------------------------------+
#property copyright "Lowphat © 2006"
#property link      ""
#property indicator_separate_window
extern bool AlertOn=false;
bool firststart;
int SpreadPrev,Spread, Spreadhold;
int nDigits;
int init(){IndicatorShortName("Spread Monitor");firststart=true;return(0);}
int deinit(){return(0);}

int start()
  {
 
if (firststart==false){if (Spread!=NormalizeDouble((Ask-Bid)/Point,0)) {SpreadPrev=Spread;if (AlertOn) Alert ("Spread Change on ",Symbol())   ;  //PlaySound("alert2.wav"); 
}
Spread=NormalizeDouble((Ask-Bid)/Point,0); }
if (firststart==true){SpreadPrev=NormalizeDouble((Ask-Bid)/Point,0);Spread=NormalizeDouble((Ask-Bid)/Point,0);firststart=false;} 
string alrt;
if (AlertOn)alrt="On";else alrt="Off";
        ObjectCreate("Spread Monitor1", OBJ_LABEL, WindowFind("Spread Monitor"), 0, 0);
        ObjectSetText("Spread Monitor1","Current Spread:", 10, "Arial Bold", CadetBlue);
        ObjectSet("Spread Monitor1", OBJPROP_CORNER, 0);
        ObjectSet("Spread Monitor1", OBJPROP_XDISTANCE, 150);
        ObjectSet("Spread Monitor1", OBJPROP_YDISTANCE, 2);
        ObjectCreate("Spread Monitor2", OBJ_LABEL, WindowFind("Spread Monitor"), 0, 0);
        ObjectSetText("Spread Monitor2",DoubleToStr(Spread ,0),10, "Arial Bold", Lime);
        ObjectSet("Spread Monitor2", OBJPROP_CORNER, 0);
        ObjectSet("Spread Monitor2", OBJPROP_XDISTANCE, 260);
        ObjectSet("Spread Monitor2", OBJPROP_YDISTANCE, 2);
        ObjectCreate("Spread Monitor3", OBJ_LABEL, WindowFind("Spread Monitor"), 0, 0);
        ObjectSetText("Spread Monitor3","Previous Spread:", 10, "Arial Bold", CadetBlue);
        ObjectSet("Spread Monitor3", OBJPROP_CORNER, 0);
        ObjectSet("Spread Monitor3", OBJPROP_XDISTANCE, 350);
        ObjectSet("Spread Monitor3", OBJPROP_YDISTANCE, 2);
        ObjectCreate("Spread Monitor4", OBJ_LABEL, WindowFind("Spread Monitor"), 0, 0);
        ObjectSetText("Spread Monitor4",DoubleToStr( SpreadPrev ,0),10, "Arial Bold", Lime);
        ObjectSet("Spread Monitor4", OBJPROP_CORNER, 0);
        ObjectSet("Spread Monitor4", OBJPROP_XDISTANCE, 470);
        ObjectSet("Spread Monitor4", OBJPROP_YDISTANCE, 2);
        ObjectCreate("Spread Monitor5", OBJ_LABEL, WindowFind("Spread Monitor"), 0, 0);
        ObjectSetText("Spread Monitor5","Alert:", 10, "Arial Bold", CadetBlue);
        ObjectSet("Spread Monitor5", OBJPROP_CORNER, 0);
        ObjectSet("Spread Monitor5", OBJPROP_XDISTANCE, 560);
        ObjectSet("Spread Monitor5", OBJPROP_YDISTANCE, 2);
        ObjectCreate("Spread Monitor6", OBJ_LABEL, WindowFind("Spread Monitor"), 0, 0);
        ObjectSetText("Spread Monitor6",alrt,10, "Arial Bold", Lime);
        ObjectSet("Spread Monitor6", OBJPROP_CORNER, 0);
        ObjectSet("Spread Monitor6", OBJPROP_XDISTANCE, 600);
        ObjectSet("Spread Monitor6", OBJPROP_YDISTANCE, 2);
        

   return(0);
  }

