Increasing shift for iLow/iHigh

 

I need to increase shift for each new candle until shift=5, after it has to come back to 2 . This is the code :


{
         if(GetTime(TF1,9) != EMPTY_VALUE) LastSellSignalTF1 = GetTime(TF1,9);
         if(GetTime(TF1,7) != EMPTY_VALUE) LastBuySignalTF1 = GetTime(TF1,7);
         if(RSIDiv(TF1,0)>0 && RSIDiv(TF1,0)!=EMPTY_VALUE && iStochastic(Symbol(),PERIOD_M5,InpKPeriod,InpDPeriod,InpSlowing,MODE_SMA,STO_CLOSECLOSE,MODE_MAIN,Shift)>iStochastic(Symbol(),PERIOD_M5,InpKPeriod,InpDPeriod,InpSlowing,MODE_SMA,STO_CLOSECLOSE,MODE_SIGNAL,Shift)+StochDelta && iStochastic(Symbol(),PERIOD_M15,InpKPeriod,InpDPeriod,InpSlowing,MODE_SMA,STO_CLOSECLOSE,MODE_MAIN,Shift)>iStochastic(Symbol(),PERIOD_M15,InpKPeriod,InpDPeriod,InpSlowing,MODE_SMA,STO_CLOSECLOSE,MODE_SIGNAL,Shift)+StochDelta && 
            GetTime(TF1,6)>LastSellSignalTF1 && Bid<=iLow(Symbol(),TF1,2))
           {
            lastTime=(int)(GetTime(TF1,7)-GetTime(TF1,6));
            OrderEntry(0,"TF1 Trade",lastTime);
            trade1=0;
            int timen=(int)TimeCurrent();



And in particular this is the part :

(Bid<=iLow(Symbol(),TF1,2)
Reason: