//+------------------------------------------------------------------+
//|                                                  HLine Alert.mq4 |
//+------------------------------------------------------------------+
#property copyright "raff1410@o2.pl"

#property indicator_chart_window
extern string LineName="MyLineL";
extern string LineName1="MyLineH";
extern color LineColor=Pink; 
extern color LineColor1=DodgerBlue; 
extern int LineStyle=STYLE_SOLID;
extern int LineStyle1=STYLE_SOLID;
extern int pipDistance = 500;
extern string AlertWav="alert.wav";

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();

      ObjectCreate(LineName, OBJ_HLINE, 0, 0, Bid - pipDistance*Point);
      ObjectSet(LineName, OBJPROP_STYLE, LineStyle);
      ObjectSet(LineName, OBJPROP_COLOR, LineColor);
      
      ObjectCreate(LineName1, OBJ_HLINE, 0, 0, Bid + pipDistance*Point);
      ObjectSet(LineName1, OBJPROP_STYLE, LineStyle1);
      ObjectSet(LineName1, OBJPROP_COLOR, LineColor1);
        
      double val =  ObjectGet( LineName, OBJPROP_PRICE1);
      if (Bid <= val ) PlaySound(AlertWav);
      
      double val1 =  ObjectGet( LineName1, OBJPROP_PRICE1);
      if (Bid >= val1 ) PlaySound(AlertWav);








//----
//----
   return(0);
  }
//+------------------------------------------------------------------+