Question, what am I doing wrong? The arrays (STATIC) are filled in, but the calculation gives 0 (zero). Can you tell me what I don't have in my code? Why the array elements are not being compared and added...? Thanks
double Open[60],High[60],Lo[60,Close[60]; int to_copy=60;
Question, what am I doing wrong? The arrays (STATIC) are filled in, but the calculation gives 0 (zero). Can you tell me what I don't have in my code? Why the array elements are not being compared and added...? Thanks
1) The loop goes beyond the array - if the buffer size is 60, the last index is 59, because the first index is 0
2) The code is not complete - e.g. how is Tf defined and what was candle initialised with?
* when copying prices the indexing is shifted by one, because you copy 60 elements starting from the first index, i.e. prices of the first closed bar will already be under index 0
In help it is written - "Checks forced termination of mql5-program". That is, it sort of "looks" at some number of lines of code ahead and checks if anything is correct? How is its area of responsibility set (e.g. per line or 10 lines)?
I thought it only prevents the loop from going beyond the array, but I saw it back in the FAMA code before copying High and Low prices
In help it is written - "Checks forced termination of mql5-program". That is, it sort of "looks" at some number of lines of code ahead and checks if anything is correct? How is its area of responsibility set (e.g. per line or 10 lines)?
I thought it only prevents the loop from going beyond the array, but I saw it still in the FAMA code before copying prices High and Low
It doesn't look anywhere... It's clearly written there. It checks the flag... Reread it.
Возвращает true, если в системной переменной _StopFlag содержится значение, отличное от 0. Ненулевое значение записывается в переменную _StopFlag, если поступила команда завершить...
In help it is written - "Checks forced termination of mql5-program". That is, it sort of "looks" at some number of lines of code ahead and checks if anything is correct? How is its area of responsibility set (e.g. per line or 10 lines)?
I thought it only prevents the loop from going beyond the array, but I saw it in the FAMA code before copying the High and Low prices
if a stop of an MQL-program takes place, the _StopFlag will be set, and it can be checked either using a predefined variable or the IsStopped() function - whatever is convenient, use it that way.
after setting _StopFlag , MQL-program has a little time to stop, and then the terminal forcibly unloads it
the most widespread use - looped scripts, you should not
while(true)
{
...
}
it is better to write it this way:
while(!IsStopped())
{
...
}
well, sometimes in cost calculations or in large cycles they use
1) The loop has an array overrun - if the buffer size is 60, then the last index will be 59, as the first index is 0
2) The code is not complete - e.g. how is Tf defined and what was candle initialised with?
* when copying prices the indexing is shifted by one, as you copy 60 elements starting from the first index, i.e. the prices of the first closed bar will already be under index 0
THANK YOU for your reply. Full code. Increased the static size of the array. Removed zero control entry in operators. Common "dummy". I'm still trying to figure out WHY it's not adding. What's not in my code now? Thanks for the tips. I haven't worked with static arrays in mql5 yet.....
Допускается объявление не более чем 4-мерного массива. При объявлении динамического массива (массива с неуказанным значением в первой паре квадратных скобок) компилятор автоматически создает переменную указанной выше структуры (объект динамического массива) и обеспечивает код для правильной инициализации. Статические массивы При явном...
Full code. Increased static array size. Removed write zero control in operators... Common "dummy". Still want to understand WHY it doesn't count addition. What is missing in my code now? Thanks for the tips. I haven't worked withstatic arrays in mql5 yet.....
Допускается объявление не более чем 4-мерного массива. При объявлении динамического массива (массива с неуказанным значением в первой паре квадратных скобок) компилятор автоматически создает переменную указанной выше структуры (объект динамического массива) и обеспечивает код для правильной инициализации. Статические массивы При явном...
THANK YOU for the reply. Full code. Increased static array size. Removed zero control entry in operators... Common "dummy". I'm still trying to figure out WHY it's not adding. What is missing in my code now? Thanks for the tips. I haven't worked with static arrays in mql5 yet.....
I UPDATED THE CODE. The question is the same...
I am not familiar with indicators, but it's just unnecessary. I already have it ))))
intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
//+------------------------------------------------------------------+//| Поиск события и установка меток на графике |//+------------------------------------------------------------------+if(CopyOpen(NULL,PERIOD_H4,0,to_copy,Open)<to_copy)
return(0);
if(CopyHigh(NULL,PERIOD_H4,0,to_copy,High)<to_copy)
return(0);
if(CopyLow(NULL,PERIOD_H4,0,to_copy,Low)<to_copy)
return(0);
if(CopyClose(NULL,PERIOD_H4,0,to_copy,Close)<to_copy)
return(0);int indexmass=ArraySize(Open);
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.
Good internet and good health to all.
Question, what am I doing wrong? The arrays (STATIC) are filled in, but the calculation gives 0 (zero). Can you tell me what I don't have in my code? Why the array elements are not being compared and added...? Thanks
double Open[60],High[60],Lo[60,Close[60]; int to_copy=60;Comment(High[10],". ",candle);candle дает результат 0 нольGood internet and good health to all.
Question, what am I doing wrong? The arrays (STATIC) are filled in, but the calculation gives 0 (zero). Can you tell me what I don't have in my code? Why the array elements are not being compared and added...? Thanks
1) The loop goes beyond the array - if the buffer size is 60, the last index is 59, because the first index is 0
2) The code is not complete - e.g. how is Tf defined and what was candle initialised with?
* when copying prices the indexing is shifted by one, because you copy 60 elements starting from the first index, i.e. prices of the first closed bar will already be under index 0
How the function works
IsStopped();... and what list of tasks does it perform?
In help it is written - "Checks forced termination of mql5-program". That is, it sort of "looks" at some number of lines of code ahead and checks if anything is correct? How is its area of responsibility set (e.g. per line or 10 lines)?
I thought it only prevents the loop from going beyond the array, but I saw it back in the FAMA code before copying High and Low prices
How the function works
... and what list of tasks does it perform?
In help it is written - "Checks forced termination of mql5-program". That is, it sort of "looks" at some number of lines of code ahead and checks if anything is correct? How is its area of responsibility set (e.g. per line or 10 lines)?
I thought it only prevents the loop from going beyond the array, but I saw it still in the FAMA code before copying prices High and Low
It doesn't look anywhere... It's clearly written there. It checks the flag... Reread it.
How the function works
... and what list of tasks does it perform?
In help it is written - "Checks forced termination of mql5-program". That is, it sort of "looks" at some number of lines of code ahead and checks if anything is correct? How is its area of responsibility set (e.g. per line or 10 lines)?
I thought it only prevents the loop from going beyond the array, but I saw it in the FAMA code before copying the High and Low prices
if a stop of an MQL-program takes place, the _StopFlag will be set, and it can be checked either using a predefined variable or the IsStopped() function - whatever is convenient, use it that way.
after setting _StopFlag , MQL-program has a little time to stop, and then the terminal forcibly unloads it
the most widespread use - looped scripts, you should not
it is better to write it this way:
well, sometimes in cost calculations or in large cycles they use
Hi all.
Can you tell me if it's possible to loop through variables with names: L1, L2, L3 ... Ln to write to a two-dimensional array
1) The loop has an array overrun - if the buffer size is 60, then the last index will be 59, as the first index is 0
2) The code is not complete - e.g. how is Tf defined and what was candle initialised with?
* when copying prices the indexing is shifted by one, as you copy 60 elements starting from the first index, i.e. the prices of the first closed bar will already be under index 0
THANK YOU for your reply. Full code. Increased the static size of the array. Removed zero control entry in operators. Common "dummy". I'm still trying to figure out WHY it's not adding. What's not in my code now? Thanks for the tips. I haven't worked with static arrays in mql5 yet.....
I UPDATED THE CODE. The question is the same...
Comment("indexmass ",indexmass," Open ",Open[10]," candle ",candle," averpips ",averpips);Hi all.
Can you tell me if it's possible to loop through variables with names: L1, L2, L3 ... Ln to write into a two-dimensional array
deleted the post - you know about arrays
but still not possible
as an option to write a macro substitution, write a specific example - maybe someone will write a macro to your task, I'm bad at writing macros.
People!!! (Hint ... )))
Full code. Increased static array size. Removed write zero control in operators... Common "dummy". Still want to understand WHY it doesn't count addition. What is missing in my code now? Thanks for the tips. I haven't worked withstatic arrays in mql5 yet.....
I UPDATED THE CODE. The question is the same...
THANK YOU for the reply. Full code. Increased static array size. Removed zero control entry in operators... Common "dummy". I'm still trying to figure out WHY it's not adding. What is missing in my code now? Thanks for the tips. I haven't worked with static arrays in mql5 yet.....
I UPDATED THE CODE. The question is the same...
I am not familiar with indicators, but it's just unnecessary. I already have it ))))