//+------------------------------------------------------------------+
//|                     2020 zigzag alerts only no trades alerts.mq4 |
//|                                                          ......h |
//|                                                    hayseedfx.com |
//+------------------------------------------------------------------+
#property copyright "......h"
#property link      "hayseedfx.com"
#include <WinUser32.mqh>
#property strict


 input  bool   zigzagalert                    =  true;  // alert on new zigzag leg
 input  int    zztimeframe                    =     0;  // set zigzag timeframe to be monitored
 
        //double ProfitTarget;
        //double Stoploss;      
        int    alertcnt;
        int    pmcnt;
//+------------------------------------------------------------------+  
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
 
      pmcnt    = 0;
      alertcnt = 0;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----

    double zigzag = iCustom(NULL,0,"ZigZag",12,5,3, 0, 0);



     if((alertcnt < 10) && (zigzagalert))
     {
     if(iCustom(Symbol(),zztimeframe,"ZigZag",12,5,3, 0, 0) > 0.0)   {Alert(Symbol() + " "+ IntegerToString(zztimeframe)+" ZigZag new leg "+IntegerToString(alertcnt)); alertcnt++;}
     }


     if((pmcnt < 3) && (zigzagalert))
     {
     if(iCustom(Symbol(),zztimeframe,"ZigZag",12,5,3, 0, 0) > 0.0)   {SendNotification("New zigzag leg on "+Symbol()+" "+IntegerToString(zztimeframe)); pmcnt++;}
     }
     
     
       double week =  iATR(NULL,10080,50,1) -(MathMax(MarketInfo(NULL,MODE_POINT),(iHigh(NULL,10080,0)-iLow(NULL,10080,0))));
       
       Display("week atr left", 10 ,150); 
       ObjectSetText("week atr left", "weekly atr left is "+DoubleToStr((week/MarketInfo(NULL,MODE_POINT)*0.1),0), 14, "Verdana",Aqua);
 
 
     
       Display("daily atr", 10 ,170); 
       ObjectSetText("daily atr", "daily atr is "+DoubleToStr((iATR(NULL,1440,50,1)/MarketInfo(NULL,MODE_POINT)*0.1),0), 14, "Verdana", Aqua);


       double today =  iATR(NULL,1440,50,1) -(MathMax(MarketInfo(NULL,MODE_POINT),(iHigh(NULL,1440,0)-iLow(NULL,1440,0))));
       
       Display("atr left", 10 ,190); 
       ObjectSetText("atr left", "daily atr left is "+DoubleToStr((today/MarketInfo(NULL,MODE_POINT)*0.1),0), 14, "Verdana",Aqua);
    
       double four =  iATR(NULL,240,50,1) -(MathMax(MarketInfo(NULL,MODE_POINT),(iHigh(NULL,240,0)-iLow(NULL,240,0))));
       
       Display("240 atr left", 10 ,210); 
       ObjectSetText("240 atr left", "240 atr left is "+DoubleToStr((four/MarketInfo(NULL,MODE_POINT)*0.1),0), 14, "Verdana",Aqua);
       

      
//----
   return(0);
  }
//+------------------------------------------------------------------+



 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);
      }   
   
      
//-----
//-----

  
  
  