Issue While checking the The Arrow visibility on the lower timeframe

 

Can someone please point out what's wrong with my logic?

What I'm Trying To Do: 

I am trying to make the Indicator Draw Arrow based on these conditions:

If there is a bullish candle then check if the arrow indicator had shown an arrow on the lower timeframe during the interval of current timeframes candle 
meaning

if its attached to h1 and if the last closed candle  is a bullish candle on H1 then it checks if there was an arrow on m30 on last 2 closed candles 

and if its attached to m5 and the last closed candle  is a bullish candle then it checks if there is an arrow on m1 during last  5 candles ?
and vice versa for bearish candle .

I tried running it on chart and it does not show any arrow, so there must be something wrong with my logic , can someone please help and point out what am i doing wrong ?

My Code:

int cnt;
int tf;
if(Period() == 5)	{	tf= PERIOD_M1;cnt=5;	}
  
if(Period() == 15)	{	tf= PERIOD_M5;cnt=3;	}
  
if(Period() == 30)	{	tf= PERIOD_M15;cnt=2;	}
  
if(Period() == 60)	{	tf= PERIOD_M30;cnt=2;	}
      
if(Period() == 240)	{	tf= PERIOD_H1;cnt=4;	}

if(Period() == 1440)	{	tf= PERIOD_H4;cnt=6;	}

   for(int i = 0; i <= 100000; i++)
     {
      open1 = Open [1+i];close1= Close[1+i];datetime ytime= Time[i];
      if(open1 > close1 )
      {
      for(int j=1;j<=cnt;j++)
        {
         if(iCustom(Symbol(),tf,"ArrowInd",1,j)!= EMPTY_VALUE && Time[j]>= ytime)
           { 
              {
                  Buffer1[1+i] = Low[1+i]- iATR(NULL,PERIOD_CURRENT,1,1+i); break;
              }  
           }
           else
                 {
                  Buffer1[1+i] = EMPTY_VALUE;
                 }
        }
      }
        if ( open1 < close1 )
        {
        for(int k=0;k<=cnt;k++)
          {
           if(iCustom(Symbol(),tf,"ArrowInd",0,k)!= EMPTY_VALUE && Time[j]>= ytime)
             {
                    {
                        Buffer2[1+i] = High[1+i]- iATR(NULL,PERIOD_CURRENT,1,1+i); break;
                    }
                    
             }
              else
                       {
                        Buffer2[1+i] = EMPTY_VALUE;
                       }
          }
        }
     } 

Thank you 
Best Regards