The int type has a size of 4 bytes (32 bits). The minimum value is -2 147 483 648, the maximum value is 2 147 483 647.
MyiBarShift does not want to give a value greater than 99999
I draw a trend line on the chart, the following script gets the start time of the line and outputs the bar number of that time.
When the line is shifted back in the history at some point the output value stops at 99999, and if
boolexact=false// mode
change it to true, it prints -1, and GetLastError = 0
voidOnStart()
{
int total = ObjectsTotal(0, 0, -1); // Общее кол-во объектов на: /текущий график/главное окно/все типы объектовdatetime time0 = 0; // Время соответствующее началу трендовой линииstring objname = ""; // Имя объекта (трендовой линии)int shift = 0; // Номер бара, соответствующего времени начала трендовой линии time0for(int i = total - 1; i >= 0; i--)
{
objname = (string)ObjectName(0, i, 0, OBJ_TREND);
time0 = ObjectGetInteger(0, objname, OBJPROP_TIME, 0);
shift = iBarShift(NULL, PERIOD_M1, time0, false);
Comment("shift: ", shift, " Error: ", GetLastError());
Sleep(2000);
}
}
What's wrong?
I tried different charts of different brokers, the time from the line is reading correctly, if I change PERIOD_M1 to M5, for example, then I need to move further in the history to reach 99999
Целый тип char занимает в памяти 1 байт (8 бит) и позволяет выразить в двоичной системе счисления 2^8 значений=256. Тип char может содержать как положительные, так и отрицательные значения. Диапазон изменения значений составляет от -128 до 127. uchar # Целый тип uchar также занимает в памяти 1 байт, как и тип char, но в отличие от него, uchar...
The int type has a size of 4 bytes (32 bits). The minimum value is -2 147 483 648, the maximum value is 2 147 483 647.
MyiBarShift does not want to give a value greater than 99999
I draw a trend line on the chart, the following script gets the start time of the line and outputs the bar number of that time.
When the line is shifted back in the history at some point the output value stops at 99999, and if
boolexact=false// mode
change it to true, it prints -1, and GetLastError = 0
What's wrong?
I tried different charts of different brokers, the time from the line is reading correctly, if I change PERIOD_M1 to M5, for example, I need to move further in the history to reach 99999.
First of all check the maximum number of bars in the terminal settings.
intOnInit()
{
//-создадим хэндл индикатораhandle=iAO(name,period);
//-если не удалось создать хэндлif(handle==INVALID_HANDLE)
{
...
return(INIT_FAILED);
}
Question: From what parameters is the number (digits) of a handle assigned? Can it be different after restarting the terminal? Can it be different after a chart reinitialization? In what cases can it change?
Question: From what parameters is the number (digits) of a handle assigned? Can it be different after restarting the terminal? Can it be different after a chart reinitialization? In what cases can it change?
If there is only one indicator, it always has a handle of 10. Each successive one is equal to the previous one+1 and it all depends on the order in which the handles were created. It can only change if one of the previous ones gets an error.
If you have one indicator, it always has a handle of 10. Each next one is equal to the previous one+1 and it all depends on the order in which the handles were created. It can only change if one of the previous ones gets an error.
Question: From what parameters is the number (digits) of a handle assigned? Can it be different after restarting the terminal? Can it be different after a chart reinitialisation? In what cases can it change?
Предположим, что нам вдруг наскучил классический MQL5-доступ к индикаторам и захотелось сравнить скорость доступа в сравнении с альтернативными вариантами. Например, сравним его с доступом к индикаторам в стиле MQL4 без кэширования и с кэшированием. Идеи с доступом в MQL4-стиле были взяты из статьи LifeHack для трейдера: готовим фастфуд из...
Стандартная библиотека MQL5 написана на языке MQL5 и предназначена для облегчения написания программ (индикаторов, скриптов, экспертов) конечным пользователям. Библиотека обеспечивает удобный доступ к большинству внутренних функций MQL5.
If I simply specify MyFun( &Mas[][] ) in the header, the compiler generates an error on accessing an array element Mas[j][k] in the function body... But how?
There seems to be no problem with one-dimensional ones.
If I simply specify MyFun( &Mas[][] ) in the header, the compiler generates an error on accessing an array element Mas[j][k] in the function body... But how?
There seems to be no problem with one-dimensional arrays.
The second and the next array's dimensions cannot be dynamic. Consequently, it must be MyFun(int &Mas[][7]) declared as an array, for example, int Mas[][7]; so it should be received.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
MQL5 iBarShift
According to mql5 documentation, the iBarShift function returns a value of int type.
int#
The int type has a size of 4 bytes (32 bits). The minimum value is -2 147 483 648, the maximum value is 2 147 483 647.
MyiBarShift does not want to give a value greater than 99999
I draw a trend line on the chart, the following script gets the start time of the line and outputs the bar number of that time.
When the line is shifted back in the history at some point the output value stops at 99999, and if
boolexact=false// mode
change it to true, it prints -1, and GetLastError = 0
What's wrong?
I tried different charts of different brokers, the time from the line is reading correctly, if I change PERIOD_M1 to M5, for example, then I need to move further in the history to reach 99999
MQL5 iBarShift
According to mql5 documentation, the iBarShift function returns a value of int type.
int#
The int type has a size of 4 bytes (32 bits). The minimum value is -2 147 483 648, the maximum value is 2 147 483 647.
MyiBarShift does not want to give a value greater than 99999
I draw a trend line on the chart, the following script gets the start time of the line and outputs the bar number of that time.
When the line is shifted back in the history at some point the output value stops at 99999, and if
boolexact=false// mode
change it to true, it prints -1, and GetLastError = 0
What's wrong?
I tried different charts of different brokers, the time from the line is reading correctly, if I change PERIOD_M1 to M5, for example, I need to move further in the history to reach 99999.
First of all check the maximum number of bars in the terminal settings.
First check the maximum number of bars in the terminal settings.
Thank you!
It was 10000, changed it to unlimited and it worked.
Not an obvious thing though...
Help in creating handles
Here's the thing
Question: From what parameters is the number (digits) of a handle assigned?
Can it be different after restarting the terminal?
Can it be different after a chart reinitialization?
In what cases can it change?
Help in creating handles
Here's the thing
Question: From what parameters is the number (digits) of a handle assigned?
Can it be different after restarting the terminal?
Can it be different after a chart reinitialization?
In what cases can it change?
If there is only one indicator, it always has a handle of 10. Each successive one is equal to the previous one+1 and it all depends on the order in which the handles were created. It can only change if one of the previous ones gets an error.
If you have one indicator, it always has a handle of 10. Each next one is equal to the previous one+1 and it all depends on the order in which the handles were created. It can only change if one of the previous ones gets an error.
I see, it's more or less understood. Thank you!
Help in creating handles
There's a thing like this
Question: From what parameters is the number (digits) of a handle assigned?
Can it be different after restarting the terminal?
Can it be different after a chart reinitialisation?
In what cases can it change?
Found answers
Please advise how to correctly pass a multidimensional array into a function.
If I simply specify MyFun( &Mas[][] ) in the header, the compiler generates an error on accessing an array element Mas[j][k] in the function body... But how?
There seems to be no problem with one-dimensional ones.
Please advise how to correctly pass a multidimensional array into a function.
If I simply specify MyFun( &Mas[][] ) in the header, the compiler generates an error on accessing an array element Mas[j][k] in the function body... But how?
There seems to be no problem with one-dimensional arrays.
The second and the next array's dimensions cannot be dynamic. Consequently, it must be MyFun(int &Mas[][7]) declared as an array, for example, int Mas[][7]; so it should be received.