'inTimeInterval' - function not defined

 
Hello everyone, I am having This problem, the code seems to be written all right but if I insert the filter time from 8:00 to 20:00 I get the error 'inTimeInterval' - function not defined

Where am I doing wrong?


#property copyright ""
#property link      ""
#property version   "1.00"
#property description ""

#include <stdlib.mqh>
#include <stderror.mqh>

//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 4

#property indicator_type1 DRAW_ARROW
#property indicator_width1 1
#property indicator_color1 Red
#property indicator_label1 "Sell"

#property indicator_type2 DRAW_ARROW
#property indicator_width2 1
#property indicator_color2 Lime
#property indicator_label2 "Buy"

#property indicator_type3 DRAW_ARROW
#property indicator_width3 2
#property indicator_color3 Yellow
#property indicator_label3 "Pre-Sell"

#property indicator_type4 DRAW_ARROW
#property indicator_width4 2
#property indicator_color4 Yellow
#property indicator_label4 "Pre-Buy"



//--- Indicator Buffer
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];


extern double HistograM = 0.00001;
extern double HistograMneg = -0.00001;
extern double Signal_Buy = -0.00010;
extern double Signal_Sell = 0.00010;


int TOD_From_Hour = 08; //time of the day
int TOD_From_Min = 00; //time of the day
int TOD_To_Hour = 20; //time of the day
int TOD_To_Min = 00; //time of the day



datetime time_alert; //used when sending alert
extern bool Audible_Alerts = false;
double myPoint; //initialized in OnInit



void myAlert(string type, string message)
  {
   if(type == "print")
      Print(message);
   else if(type == "error")
     {
      Print(type+" | GbbiLadroV2 @ "+Symbol()+","+Period()+" | "+message);
     }
   else if(type == "order")
     {
     }
   else if(type == "modify")
     {
     }
   else if(type == "indicator")
     {
      if(Audible_Alerts) Alert(type+" | GbbiLadroV2 @ "+Symbol()+","+Period()+" | "+message);
     }
  }
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {   
   IndicatorBuffers(4);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, 0);
   SetIndexArrow(0, 242);
   SetIndexBuffer(1, Buffer2);
   SetIndexEmptyValue(1, 0);
   SetIndexArrow(1, 241);
   SetIndexBuffer(2, Buffer3);
   SetIndexEmptyValue(2, 0);
   SetIndexArrow(2, 159);
   SetIndexBuffer(3, Buffer4);
   SetIndexEmptyValue(3, 0);
   SetIndexArrow(3, 159);
      //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
     }
    
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
   
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   ArraySetAsSeries(Buffer2, true);
   ArraySetAsSeries(Buffer3, true);
   ArraySetAsSeries(Buffer4, true);
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      ArrayInitialize(Buffer2, 0);
      ArrayInitialize(Buffer3, 0);
      ArrayInitialize(Buffer4, 0);
     }      
    else
      limit++;
   
   //--- main loop
   for(int i = limit-1; i >= 0; i--)
     {
      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation 
      
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

     
            
              
      //Indicator Buffer 1 Segnale SELL
      if iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 1,  PRICE_CLOSE, 1+i) >  HistograM     //macd_2tonecolor > fixed value + Candlestick Close
      && iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 1,  PRICE_CLOSE, 2+i) >  HistograM    //macd_2tonecolor > fixed value + Candlestick Close
      && iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 1,  PRICE_CLOSE, 3+i) >  HistograM   //macd_2tonecolor > fixed value + Candlestick Close
      && iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 3,  PRICE_CLOSE, 1+i) <= Signal_Sell //macd_2tonecolor <= fixed value     
      
      )
        {
         //Istruzioni Freccia Sell  
         if(!inTimeInterval(Time[i], TOD_From_Hour, TOD_From_Min, TOD_To_Hour, TOD_To_Min)) continue; //draw indicator only at specific times of the day     
         Buffer1[i] = High[i] +2 * myPoint; //Set indicator value at Candlestick Close + fixed value
         //Istruzioni Delete pallino Pre-Sell
         ArrayInitialize(Buffer3, 0);
         ArrayInitialize(Buffer4, 0);
         
        }
      else
        {
         Buffer1[i] = 0;
        }
      //Indicator Buffer 2 Segnale BUY
      if iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 2,  PRICE_CLOSE, 1+i) <  HistograMneg  //macd_2tonecolor < fixed value + Candlestick Close
      && iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 2,  PRICE_CLOSE, 2+i) <  HistograMneg //macd_2tonecolor < fixed value + Candlestick Close
      && iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 2,  PRICE_CLOSE, 3+i) <  HistograMneg  //macd_2tonecolor < fixed value + Candlestick Close
      && iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 3,  PRICE_CLOSE, 1+i) >= Signal_Buy //macd_2tonecolor <= fixed value
      
         
      )
        {
         //Istruzioni Freccia Buy 
         if(!inTimeInterval(Time[i], TOD_From_Hour, TOD_From_Min, TOD_To_Hour, TOD_To_Min)) continue; //draw indicator only at specific times of the day
         Buffer2[i] = Low[i] -2 * myPoint;   //Set indicator value at Candlestick Close - fixed value
         //Istruzioni Delete pallino Pre-Sell
         ArrayInitialize(Buffer3, 0);
         ArrayInitialize(Buffer4, 0);
                   
        }
      else
        {
         Buffer2[i] = 0;
        }
        //Indicator Buffer 3 Segnale Pre-SELL        
      if iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 1,  PRICE_CLOSE, 1+i) > HistograM     //macd_2tonecolor > fixed value + Candlestick Close
      && iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 1,  PRICE_CLOSE, 2+i) > HistograM    //macd_2tonecolor > fixed value + Candlestick Close
            
      )
        {
         //Istruzioni Pallino Pre-Sell   
         
         if(!inTimeInterval(Time[i], TOD_From_Hour, TOD_From_Min, TOD_To_Hour, TOD_To_Min)) continue; //draw indicator only at specific times of the day     
         Buffer3[i] = High[i] +2 * myPoint; //Set indicator value at Candlestick Close + fixed value
         if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Sell"); time_alert = Time[0]; } //Instant alert, only once per bar
        }      
       
      //Indicator Buffer 4 Segnale Pre-BUY
      if iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 2,  PRICE_CLOSE, 1+i) < HistograMneg  //macd_2tonecolor < fixed value + Candlestick Close
      && iCustom(NULL, PERIOD_CURRENT,  "macd_2tonecolor", 2, 4, 2, 2,  PRICE_CLOSE, 2+i) < HistograMneg //macd_2tonecolor < fixed value + Candlestick Close
      
      )
        {
        //Istruzioni Pallino Pre-Sell    
         if(!inTimeInterval(Time[i], TOD_From_Hour, TOD_From_Min, TOD_To_Hour, TOD_To_Min)) continue; //draw indicator only at specific times of the day     
         Buffer4[i] = Low[i] -2 * myPoint; //Set indicator value at Candlestick Close - fixed value
         if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Sell"); time_alert = Time[0]; } //Instant alert, only once per bar
         }
           }
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
You have not defined the function called "inTimeInterval". It seems that you have copy/pasted from some other code and did not include the definition for that function in your own code.
 

Thanks for your answer I added this definition and it seems to work even if the compiler gives me this warning.

The indicator seems to work but I can run into some error?

bool inTimeInterval(datetime t, int TOD_From_Hour, int TOD_From_Min, int TOD_To_Hour, int TOD_To_Min)
  {
   string TOD = TimeToString(t, TIME_MINUTES);
   string TOD_From = StringFormat("%02d", TOD_From_Hour)+":"+StringFormat("%02d", TOD_From_Min);
   string TOD_To = StringFormat("%02d", TOD_To_Hour)+":"+StringFormat("%02d", TOD_To_Min);
   return((StringCompare(TOD, TOD_From) >= 0 && StringCompare(TOD, TOD_To) <= 0)
     || (StringCompare(TOD_From, TOD_To) > 0
       && ((StringCompare(TOD, TOD_From) >= 0 && StringCompare(TOD, "23:59") <= 0)
         || (StringCompare(TOD, "00:00") >= 0 && StringCompare(TOD, TOD_To) <= 0))));
  }
declaration of 'TOD_From_Hour' hides global declaration
 
fly7680:

Thanks for your answer I added this definition and it seems to work even if the compiler gives me this warning.

The indicator seems to work but I can run into some error?

That is because you declared global variables with same names as the parameter variables for that function. It will still work, but it is best to change the names of either global or the parameter variables so that they don't clash.

int TOD_From_Hour = 08; //time of the day
int TOD_From_Min = 00; //time of the day
int TOD_To_Hour = 20; //time of the day
int TOD_To_Min = 00; //time of the day
bool inTimeInterval(datetime t, int TOD_From_Hour, int TOD_From_Min, int TOD_To_Hour, int TOD_To_Min)
 
excellent. Thank you very much, and I'm a neophyte small steps with many errors. Thanks again for your patience
 

Hello every one I have this problem 

'CheckEntry' - function not defined

 
imomin: Hello every one I have this problem. 'CheckEntry' - function not defined

Then the answer is the same as the one given above. Read the thread again!

Reason: