//+------------------------------------------------------------------+
//|                                                 Price Alerts.mq4 |
//|                                                           .....h |
//|                                                    hayseedfx.com |
//+------------------------------------------------------------------+
#property copyright ".....h"
#property link      "hayseedfx.com"
#property  indicator_chart_window


extern double alertabove    =    0.0;
extern double alertbelow    =    0.0;
extern int    pips          =     50; 

//extern int    hour          =     25;

       int    cnt;
extern int    divsor        =     10;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //---- drawing settings
  
   
     if(alertabove > 0.0) {DrawHorizontalLine("above", alertabove, Red);}
     if(alertbelow > 0.0) {DrawHorizontalLine("below", alertbelow, Red);}
    
     if(pips > 0.0)       {DrawHorizontalLine("pipsabove", MarketInfo(Symbol(),MODE_ASK)+pips*10*Point, Red);}
     if(pips > 0.0)       {DrawHorizontalLine("pipsbelow", MarketInfo(Symbol(),MODE_ASK)-pips*10*Point, Red);}
   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
  

     if(MathMod(Volume[0],divsor) == 0)
     {
     if(alertabove > 0.0 && Ask > alertabove) {Alert(Symbol() ,"  is above alert setting");}
     if(alertbelow > 0.0 && Ask < alertbelow) {Alert(Symbol() ,"  is below alert setting");}
     
     if(pips > 0.0 && Ask > ObjectGet("pipsabove",OBJPROP_PRICE1)) {Alert(Symbol() ,"  is above alert setting");}
     if(pips > 0.0 && Ask < ObjectGet("pipsbelow",OBJPROP_PRICE1)) {Alert(Symbol() ,"  is below alert setting");}
     
     //if(Hour() == hour) {Alert(Symbol()+"   "+ Hour() + " oclock");}
     }
         
//---- done 
   return(0);
  }
//+------------------------------------------------------------------+





   void DrawHorizontalLine(string name, double level, color clr)              //  DrawHorizontalLine("horizontal", Ask);
   {  
   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);
   }
   


