//+------------------------------------------------------------------+
//|                                                  HLine Alert.mq4 |
//+------------------------------------------------------------------+
#property copyright "raff1410@o2.pl"

#property indicator_chart_window
extern string LineName                         = "MyLineL";
extern string LineName1                        = "MyLineH";
extern string LineName2                        = "MyLineL1";
extern string LineName3                        = "MyLineH1";
extern color LineColor                         = DeepPink; 
extern color LineColor1                        = DodgerBlue;
extern color LineColor2                        = Gold; 
extern color LineColor3                        = Lime; 
extern ENUM_LINE_STYLE    LineStyle            = STYLE_SOLID;
extern ENUM_LINE_STYLE    LineStyle1           = STYLE_SOLID;
extern ENUM_LINE_STYLE    LineStyle2           = STYLE_DASH;
extern ENUM_LINE_STYLE    LineStyle3           = STYLE_DASH;
extern int pipDistance                         = 150;
extern int pipDistance1                        = 300;
input bool alertsSound                         = True;
input bool alertsSound1                        = True;
input bool alertsSound2                        = True;
input bool alertsSound3                        = True;
extern string AlertWav                         = "news.wav";
extern string AlertWav1                        = "alert.wav";
extern string AlertWav2                        = "connect.wav";
extern string AlertWav3                        = "alert2.wav";
extern int HowManyTimeEachAlertsToPlay         = 2;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {

   ObjectsDeleteAll(0,LineName,0,OBJ_HLINE);
   ObjectsDeleteAll(0,LineName1,0,OBJ_HLINE);
   ObjectsDeleteAll(0,LineName2,0,OBJ_HLINE);
   ObjectsDeleteAll(0,LineName3,0,OBJ_HLINE);

   ChartRedraw();
   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);
      
      ObjectCreate(LineName2, OBJ_HLINE, 0, 0, Bid - pipDistance1*Point);
      ObjectSet(LineName2, OBJPROP_STYLE, LineStyle2);
      ObjectSet(LineName2, OBJPROP_COLOR, LineColor2);
      
      ObjectCreate(LineName3, OBJ_HLINE, 0, 0, Bid + pipDistance1*Point);
      ObjectSet(LineName3, OBJPROP_STYLE, LineStyle3);
      ObjectSet(LineName3, OBJPROP_COLOR, LineColor3);
        
      double val =  ObjectGet( LineName, OBJPROP_PRICE1);
      if (Bid <= val ) PlaySound(AlertWav);
      
      double val1 =  ObjectGet( LineName1, OBJPROP_PRICE1);
      if (Bid >= val1 ) PlaySound(AlertWav1);
      
      double val2 =  ObjectGet( LineName2, OBJPROP_PRICE1);
      if (Bid <= val2 ) PlaySound(AlertWav2);
      
      double val3 =  ObjectGet( LineName3, OBJPROP_PRICE1);
      if (Bid >= val3 ) PlaySound(AlertWav3);








//----
//----
   return(0);
  }
//+------------------------------------------------------------------+

  