CopyLow and CopyHigh gives the same output for different datas (symbols)

 

Hi,

   I'm working on a script. It works over all available assets, filter them according to its name and process data, briefly saying.

   The problem is: the scripts gives good outputs (by terminal I verify them) and suddenly freezes. Stopping it, the lacking outputs quickly appear and, often, they have the same value of the previous one (the output contains the associated symbol... no problem with this; only with CopyLow|High output data.). Many times, a lot of output has the same value sequentially.

  The amount of data is significantly large and, I suppose, the execution has a large payload over internet. But... It didn't seems to be related to the code itself.

  What should it be?

Thanks in advanced.
 
AnarcoPhysic: . It didn't seems to be related to the code itself.
Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked.
 
William Roeder:
Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked.
Of course, otherway I would never public the question.

If you need a specific information, and tell me, I will be happy to inform it to you.

//It freezes here, I supouse.
for(int i=0;i<SymbolsTotal(false);i++)
   {
      const string sig=SymbolName(i,false);
      const int siglen=StringLen(sig);
      //Filtra-se as siglas referentes a cada ativo. Entram só as de uma categoria (inicialmente). Este ponto é o que
      //+ define quem será considerado para os cálculos finais.
      if(siglen==siglAlen&&StringSubstr(sig,StringLen(sig)-talen,talen)==si)
      {
         ResetLastError();
         //adicionamos ao observador de mercado
         if(SymbolSelect(sig,true))
         {
            //invocamos dados históricos,
            //dado tempo inicial, selecionamos a máxima e a mínima
            //QuantosCandles(); //MUITO TRABALHO VALERÁ A PENA??(escrever uma literal para transformá-la em inteiros)
            double max[1],min[1];
//++++++++++++++++++++THE ERROR SEEMS TO BE HERE (DOWN)
            CopyHigh(sig,per_inp,iHighest(sig,per_inp,MODE_HIGH,vela0_inp,0),1,max);
            CopyLow(sig,per_inp,iLowest(sig,per_inp,MODE_LOW,vela0_inp,0),1,min);
//++++++++++++++++++++THE ERROR SEEMS TO BE HERE (UP) 
//returns the same output for different cycles in the loop (IMPROBABLE)
            printf("%s: Min %.2f / Max %.2f para os últimos %d.",sig,min[0],max[0],vela0_inp);
            if(verbosidade)printf("Sigla considerada: %s.",sig);
            SymbolSelect(sig,false);
            //procedemos com cálculos e avaliações
         
            //adicionamos à seção de apresentação gráfica
         }
         else printf("ATENÇÃO! Erro ao selecionar %s;m (erro:%d)",sig,GetLastError());
       }  
 }

This could be useful? But not keep your doubts or my lack secretaly with you, tell me. I am not a mind reader and I don't have magic crystal ball. :)
 
AnarcoPhysic:
Of course, otherway I would never public the question.

If you need a specific information, and tell me, I will be happy to inform you.

This could be useful? But not, tell me. I am not a no mind readers and I don't have magic crystal balls. :)

Your code should be improved to manage possible errors. For example CopyHigh() is a function returning a value, check it.

But beside that, the last time I check such things (2 or 3 months ago, it's somewhere on the forum), the problem was due to MT5 (client Terminal or server I don't know) and not to the code.

 
Alain Verleyen:

Your code should be improved to manage possible errors. For example CopyHigh() is a function returning a value, check it.

But beside that, the last time I check such things (2 or 3 months ago, it's somewhere on the forum), the problem was due to MT5 (client Terminal or server I don't know) and not to the code.

Thank you! So valuable your help! I will try to get more information around the return value of the functions. Good idea! (& my bad pratices)
 

Is this for a currency strength ? (what if the currency is on the first half of the symbol ?) :)

Anyway , be very careful when requesting data other than the native chart , expecially in indicators .

Assume that the default state is data missing, data arriving later ,data gaps ,and -even though i dont know what is in CopyRates function- i choose to use that -even for high and low data only-.

:: I believe its quitte possible if you call copyHigh (you poke the server for data) and subsequently call copyLow (the server has sent data) ,copy low will have more bars and your calculations will be out of sync [this is an assumption however and difficult to test because any subsequent test on a data-void-chart will have data actually].

My assumption is that CopyRates returns synced data whether it has gaps or not

Also ,when you are requesting cross timeframe data (not same timeframes) -i suspect this is not the case in your code- be ever vigilant to calculate with data that would have been visible to your code at that time if it were running live .

Finally ,be very patient as working with data in mql (especially on mt4) is like fighting a hydra . You solve one thing another one pops up