#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

input int    candles       = 100;       // Check x candles back
input int    start_from    = 10;       // Where the search candles back
//+------------------------------------------------------------------+
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+
void OnTick()
  {
  
      // Check the last x candles highest shift
      double highest;
      int highindex = iHighest(NULL,0,MODE_HIGH,candles,start_from);
      if( highindex != -1 )
          highest = High[highindex];

      // Check the last x candles lowest shift
      double lowest;
      int lowindex  = iLowest(NULL,0,MODE_LOW,candles,start_from);
      if( lowindex != -1 )
          lowest=Low[lowindex];
      
      Comment("Highest candle number :" + highindex,
              "\nLowest candle number :" + lowindex);
              
      // Get strings
      string buysignal  = ObjectDescription("HH");
      string sellsignal = ObjectDescription("LL");
      
      // Check HH/LL candles     
      int   i;
      long  chart = ChartID();
      for(int i = 0; i < candles; i++ )
        {
         string name = ObjectName(chart,i);
         if(StringFind(name,"HH",0) >0 )
            {
             double candleTime =(datetime)ObjectGetInteger(0,name,OBJPROP_TIME);
             int    shift      = iBarShift(NULL,0,candleTime);
             Comment("HH " + shift);
            }
        }       
  }   

//+------------------------------------------------------------------+
// Custom HH LL indicator
double getindi()
  {
   return(iCustom(NULL,0,"Zig Zag text",0,0));
  }
