Errors, bugs, questions - page 1090

 

Hi all! The question is more out of curiosity, "Why are the ENUM_TIMEFRAMES enumeration members assigned these particular values? Where did the number16385 come from when going from M30 to H1?"

enum ENUM_TIMEFRAMES       
{                          
PERIOD_CURRENT = 0,        
PERIOD_M1 = 1,             
PERIOD_M2 = 2,             
PERIOD_M3 = 3,             
PERIOD_M4 = 4,             
PERIOD_M5 = 5,             
PERIOD_M6 = 6,             
PERIOD_M10 = 10,           
PERIOD_M12 = 12,           
PERIOD_M15 = 15,           
PERIOD_M20 = 20,           
PERIOD_M30 = 30,           
PERIOD_H1 = 16385,  //???       
PERIOD_H2 = 16386,         
PERIOD_H3 = 16387,         
PERIOD_H4 = 16388,         
PERIOD_H6 = 16390,         
PERIOD_H8 = 16392,         
PERIOD_H12 = 16396,        
PERIOD_D1 = 16408,         
PERIOD_W1 = 32769,         
PERIOD_MN1 = 49153         
}; 

Thanks in advance for the answer(s)!!!

 
MigVRN:

Hi all! The question is more out of curiosity, "Why are the ENUM_TIMEFRAMES enumeration members assigned these particular values? Where did the number16385 come from when going from M30 to H1?"

Thanks in advance for the answer(s)!!!


PERIOD_H1 = 16385,  // = (1 << 14) + 1
PERIOD_H2 = 16386,  // = (1 << 14) + 2         
PERIOD_H3 = 16387,  // = (1 << 14) + 3
PERIOD_H4 = 16388,  // = (1 << 14) + 4
PERIOD_H6 = 16390,  // = (1 << 14) + 6
PERIOD_H8 = 16392,  // = (1 << 14) + 8
PERIOD_H12 = 16396, // = (1 << 14) + 12
 
MetaDriver:

Thank you! But I've got the question wrong as I'm even more confused now... If you don't mind, a couple of more clarifying questions:

1) Why?

2) And why 14?

:)

 
MigVRN:

Thank you! But I've got the question wrong, as I'm even more confused now... If you don't mind, a couple of more clarifying questions:

1) Why?

2) And why 14?

:)

:) And this is up to the developers .... because their ways are inscrutable.... ;)
 

I think there is an error in searching for bar by time I found it inCopyClose function (and in others too).

when copying one bar of the "alien" symbol with this function, a copying error occurs, even though this bar is present in the open window next to it.

2014.01.05 14:52:00.556 tmp (,D1) USDCAD ooo 2012.12.12 00:00:00
2014.01.05 14:51:57.214 tmp (,D1) 80.55313933496228
2014.01.05 14:51:50.947 tmp (,D1) USDCAD ooo 2013.03.04 00:00:00
2014.01.05 14:51:44.828 tmp (,D1) USDCHF ooo 2011.12.26 11:00:00
2014.01.05 14:51:37.896 tmp (,D1) USDCAD ooo 2011.03.02 12:00:00
2014.01.05 14:51:30.112 tmp (,D1) USDSEK ooo 2013.09.20 22:00:00

In the script, it is understandable, you can query until it "miraculously" finds it, but it is not acceptable for the indicator.

By the way, I remembered that I had to write the function myself since the built-in function was unable to use it for the indicator

//--------------------------------------------------------------------------+
//=   Ищет  индекс массива MqlRates по времени
//=   Протестировано 28,12,2011
//=   для прохода по 4 000 800      баров Скопировано USDJPY
//=   ошибок = 0 GetTickCount 2 200 мс.
//=   ВОЗВРАТИТ -1 в случае ошибки + сообщение Алерт
//--------------------------------------------------------------------------+
int save_indexs=0;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int FindIndex(datetime find,MqlRates &xxxxxx[])
  {
   int size_mql=ArraySize(xxxxxx);
//проверим находится ли время в массиве, и есть ли где искать
   if(size_mql<=0){Alert("ggg");return(-1);}
   if(find>xxxxxx[0].time)return(0);
   if(find<=xxxxxx[size_mql-1].time)return(size_mql-1);
//а может лежит рядом?
//проверим по скорости с глоб. перем.
   for(int i=save_indexs+1;i>=save_indexs-1 && i>=0;i--)
      if(i<size_mql)
         if(find==xxxxxx[i].time)
            return(i);
//результат с применением  ошибок = 0 GetTickCount   843 мс.
//результат без применения ошибок = 0 GetTickCount 3 744 мс.
//начнемс
   int kolvo=size_mql,
   start_save=size_mql-1,
   end_save=0;
   while(!IsStopped())
     {
      //градация поиска +1 для плавающей запятой, учесть все не ошибиться, дойдет до - минусов
      int grad=kolvo/StringLen(IntegerToString(kolvo))+1;
      if(grad<10)grad=1;
      //
      for(int start=start_save,karetka=start-grad;          start>=end_save;          start=karetka,karetka=start-grad)
        {
         //karetka может выходить за размер масс
         if(karetka<0)karetka=0;
         if(find>=xxxxxx[start].time && find<=xxxxxx[karetka].time)
           {
            kolvo=start-karetka+1;
            start_save=start;
            end_save=karetka;
            if(start==karetka+1){save_indexs=karetka;return(karetka);}
            break;//for
           }
        }
     }
   return(-1);
  }
//+------------------------------------------------------------------+

two years have passed and it's still there, it's weird.

Files:
tmp.mq5  3 kb
myusdx.mq5  5 kb
 
Inverted commas in embedded links in the forum kill the entire link
 
costy_:

there seems to be an error in searching for the bar in time in the CopyClose function (and in others, too).

....

it's been two years and it's still there, it's strange.

it's not a bug, it's a bug (c)

CopyXXX fi take data from corresponding buffers and if there is no data in buffer (alien symbol and / or timeframe is different from current one), then there will be an error. Nevertheless in this case the buffers forming process is started and if after some (sic!) time CopyXXX is called again the result may be obtained. You can't use Sleep in indicators, that's why you have to use timer, because you can't count on the next tick (output and non-liquid instruments are to blame)

 

I can't access the vault via the website, when I enter my username and password, the login and password box pops up again.

I also can't retrieve anything via MetaEditor:

Login and password are correct

Could you tell me the reason?

 
sanyooooook:

I can't log into the vault via the website, when I enter my username and password, the login and password box appears again.

I also can't retrieve anything via MetaEditor:

Login and password are correct

Could you tell me the reason?

Maybe you changed the password, there was such a bug.
 
zfs:
Maybe you changed your password, there was a bug.
Yes, I did, but I'm entering a valid password.
Reason: