Topic: Help with my first EA

Hi, I am new with MQ4 and I've tried to put this to work but there is not way to read a second NEW candle.  I've being testing in a  range of 2 weeks, and the script should look for a new candle every 5 minutes (candles of 5 minutes period).  But the problem is that only it reads the first candle only one time, and after that never come again a NEW CANDLE. I really don't know what I am missing.    Here you will see the code, please modify any part of the code and put it the Comment just to know what was wrong and learn from you.   I will really appreciate your help.

#property description "4 Candles Every 30 Minutes Expert Advisor"
#include <WinUser32.mqh>
#include <stdlib.mqh>

// Input Variables
input int HighLowBars = 8;
input int Shift = 0;
input bool TradeOnBarOpen = true;
input int MyPeriod = 5;  

// Global Variables
int hShift = iHighest(_Symbol, MyPeriod, MODE_HIGH, HighLowBars, Shift);
int lShift = iLowest(_Symbol, MyPeriod, MODE_LOW, HighLowBars, Shift);
double hHigh = High[hShift];
double lLow = Low[lShift];
double LastClose = Close[0];
bool IsHigh = false, IsLow = false;
datetime NewCandleTime = TimeCurrent();
int CeroQuince = 0;
int Resto = 0;
int Cien = 100;
int Dosciento = 200;
bool IsNewCandle=false;                   //Indicates if this is a new candle formed


//+------------------------------------------------------------------+
//| OnTick function                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
    hShift = iHighest(_Symbol, MyPeriod, MODE_HIGH, HighLowBars, Shift);
    lShift = iLowest(_Symbol, MyPeriod, MODE_LOW, HighLowBars, Shift);
    hHigh = High[hShift];
    lLow = Low[lShift];
    LastClose = Close[0];
    IsHigh = false;
    IsLow = false;

  
    // Here is the problem... There is not a new candle every 5 minutes
    if(CheckNewBar())
     {
      // If the candle is new AND it started at minute 00 OR Minute 30
      // It means, it will check for a new candle every 30 minutes
      if(Minute()==00 || Minute()==30)
        {
          CeroQuince++;    // To store the times Minutes = "00"  or = "30"
        }
      else
        {
        Resto++;    // To store the times Minutes IS NOT = "00"  or IS NOT = "30"
        }

      // This is only to show me how many NEW candles (Period = M5) it counted 
      Alert("-- Candles On 00/30 ==> " + IntegerToString(CeroQuince) + " -- Differents Candles ==> " + IntegerToString(Resto));

      // Here I will look for a Down (Bullish) or Up (Bearish) Trend
      IsLow = F_DownTrendLow(1,4);
      IsHigh = F_UpTrendLow(1,4);
    }  // End if NewBar
    else
    {
      Alert("-- This is not a New Candle -- ");
    }
    return (0);
  }  // End of OnTick


//Check if it is a new bar
//-----------------------------------
datetime NewBarTime=TimeCurrent();
bool CheckNewBar(){
   //NewBarTime contains the open time of the last bar known
   //if that open time is the same as the current bar then we are still in the current bar, otherwise we are in a new bar
   if(NewBarTime==iTime(Symbol(),PERIOD_CURRENT,0)) IsNewCandle=false;
   else{
      NewBarTime=iTime(Symbol(),PERIOD_CURRENT,0);
      IsNewCandle=true;
   }
   return(IsNewCandle);
}


// DownTrendLow
//-----------------------------------
bool F_DownTrendLow(int from, int candles)
{
  bool lResult = false;
  for(int i=from; i<=candles; i++)
  {
    if(Low[i] > Low[i+1])
    {
      lResult = false;
      break;
    }
    else
    {
      lResult = true;
    }
  }
  return(lResult);
}


// UpTrendLow
//-----------------------------------
bool F_UpTrendLow(int from, int candles)
{
  bool lResult = false;
  for(int i=from; i<=candles; i++)
  {
    if(High[i] < High[i+1])
    {
      lResult = false;
      break;
    }
    else
    {
      lResult = true;
    }
  }
  return(lResult);
}