Error

 
#property indicator_chart_window
#property indicator_buffers 3

extern string pair1 = "EURUSD";
extern string pair2 = "GBPUSD";
extern int period = PERIOD_H1;
extern int distance_type = MODE_EMA;
extern int distance_period = 20;

double dist_min[];
double dist_max[];
double dist_avg[];

int init()
{
   string symbol1 = pair1 + "m";
   string symbol2 = pair2 + "m";

   if(!IsTradeAllowed())
   {
      Print("Trading non consentito.");
      return INIT_FAILED;
   }

   if(!SymbolInfoDouble(symbol1, SYMBOL_POINT))
   {
      Print("Coppia di valute 1 non valida.");
      return INIT_FAILED;
   }

   if(!SymbolInfoDouble(symbol2, SYMBOL_POINT))
   {
      Print("Coppia di valute 2 non valida.");
      return INIT_FAILED;
   }

   if(!SetIndexBuffer(0, dist_min))
   {
      Print("Errore nella creazione del buffer per la distanza minima.");
      return INIT_FAILED;
   }

   if(!SetIndexBuffer(1, dist_max))
   {
      Print("Errore nella creazione del buffer per la distanza massima.");
      ritorno INIT_FAILED;
   }

   if(!SetIndexBuffer(2, dist_avg))
   {
      Print("Errore nella creazione del buffer per la distanza media.");
      ritorno INIT_FAILED;
   }

   IndicatorSetString(INDICATOR_SHORTNAME, "Distanza tra " + coppia1 + " e " + coppia2);

   return INIT_SUCCEEDED;
}

int inizio()
{
   datetime from_time = StrToTime("1970.01.01 00:00");
   datetime to_time = TimeCurrent();

   if(InputTime("Ora inizio", from_time) &&
      InputTime("End Time", to_time))
   {
      da_ora = OraLocale(da_ora);
      to_time = OraLocale(to_time);
   }

   doppio prezzo1[], prezzo2[];
   int copiato = CopiaChiudi(simbolo1, periodo, from_time, to_time, price1);
   if(copiato == -1)
   {
      Print("Errore nella copia dei dati per " + pair1);
      ritorno 0;
   }

   copiato = CopiaChiudi(simbolo2, periodo, from_time, to_time, price2);
   if(copiato == -1)
   {
      Print("Errore nella copia dei dati per " + pair2);
      ritorno 0;
   }

   int start_index = IndicatorCounted();
   int limite = Barre - start_index;

   for(int i = 0; i < limite; i++)
   {
      doppia distanza = MathAbs(prezzo1[i] - prezzo2[i]);

      dist_min[i] = MathMin(distanza, ArrayMinimum(dist_min, i));
      dist_max[i] = MathMax(distanza, ArrayMaximum(dist_max, i));
      dist_avg[i] = i < distance_period - 1 ? 0 : i == distanza_periodo - 1 ? ArraySum(dist_avg, i, distance_period) / distance_period : dist_avg[i-1] + (distanza - price1[i - distance_period] + price2[i - distance_period]) / distance_period;
   }

   ritorno 0;
}
quando compilo mi escono questi errori

'InputTime' - funzione non definita 65        7

'InputTime' - funzione non definita 66            7

'from_time' - conversione parametro non consentita 68 29

'to_time' - conversione parametro non consentita 69 27

'symbol1' - identificatore non dichiarato   73 27

'symbol2' - identificatore non dichiarato 80 23

'ArraySum' - funzione non definita 96 78


qualcuno puo' aiutarmi grazie.

 

Please:

  1. Use the code button from the header (</> or Alt+S) if you post code!
  2. Edit your post according to #1
  3. Describe the error with the log entry and the line it refers to.
 
Mario Soattini: can someone help me thanks.
  1. Use the code button.

  2.    datetime from_time = StrToTime("1970.01.01 00:00");

    Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
    Next time, post in the correct place. The moderators will likely move this thread there soon.

  3. Please post only in English on this part of the forums. Use the automatic translation tool if needed. Use simple language structure when using mechanical translation. (2013)
    Or use the Italiano forum

  4. This may not work, extra spaces in the string.
    datetime from_time = StrToTime(" 1970.01 . 01 00 : 00 ");
    This is the same as
    datetime from_time = StrToTime("1970.01.01 00:00");
    this
    datetime from_time = D'1970.01.01 00:00';
    and this
    datetime from_time = 0;

  5. Help you with what? You know what the problem is; undefined functions. Show us your attempt (using the CODE button) and state the nature of your difficulty.
              No free help (2017)

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2018)

    We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
              No free help (2017)