//+------------------------------------------------------------------+
//|                                       Fahrenheit 451 history.mq4 |
//|                                                          ......h |
//|                                                    hayseedfx.com |
//+------------------------------------------------------------------+
#property copyright "......h"
#property link      "hayseedfx.com"

#property indicator_chart_window

extern bool bidaskalert = false;
       int cnt;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
 {
 
 
       Display("ask",  30 ,30);
       ObjectSetText("ask", DoubleToStr(MarketInfo(Symbol(),MODE_ASK),Digits), 10, "Verdana",Lime);       


       Display("bid",  30 ,50);
       ObjectSetText("bid", DoubleToStr(MarketInfo(Symbol(),MODE_BID),Digits), 10, "Verdana", Red);       


      DrawHorizontalLine("askline",MarketInfo(Symbol(),MODE_ASK), Lime);  
      DrawHorizontalLine("bidline",MarketInfo(Symbol(),MODE_BID), Red);  
      
      if(MarketInfo(Symbol(),MODE_ASK) < MarketInfo(Symbol(),MODE_BID) && bidaskalert) {Alert("Ask < Bid");}
      if(MarketInfo(Symbol(),MODE_ASK) < MarketInfo(Symbol(),MODE_BID))                {cnt++;}
      Comment(cnt);
 
 //----
   return(0);
 }

   void DrawHorizontalLine(string name, double level, color clr)            
   {  
   ObjectDelete(name);
   ObjectCreate(name, OBJ_HLINE, 0, 0, level);
   ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet(name, OBJPROP_WIDTH, 2);
   ObjectSet(name, OBJPROP_COLOR, clr);
   } 
     
//----   
//----

 void Display(string name, int x, int y)
   {
   ObjectCreate(name, OBJ_LABEL, 0, 0, 0);
   ObjectSet(name, OBJPROP_CORNER, 1);
   ObjectSet(name, OBJPROP_XDISTANCE, x);
   ObjectSet(name, OBJPROP_YDISTANCE, y);
   ObjectSet(name, OBJPROP_BACK, FALSE);
   }   
 
//----
//----



