could any one let me know how should I solve this problem?
That kind of trouble is usually due to the "array out of range" error.
However, I can't find the corresponding part in the program you showed us.
The Meta Editor has a debugging feature, so you can try tracing with it.
What is IndicatorCounted ? Do you mean IndicatorCounted() ?
if so, this should give you a unusable index
i=Bars-Counted_bars-7; // Index of the first uncounted
if Bars is 1000 and counted bars is 999 then the index is calculated to
1000-999-7 which is -6
What is IndicatorCounted ? Do you mean IndicatorCounted() ?
That's right. I was not aware of it.
- You should stop using the old event handlers and IndicatorCounted() and start using the new ones.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
How to do your lookbacks correctly. -
i=Bars-Counted_bars-7;
Keith already pointed the problem.
How to do your lookbacks correctly.
What is IndicatorCounted ? Do you mean IndicatorCounted() ?
if so, this should give you a unusable index
if Bars is 1000 and counted bars is 999 then the index is calculated to
1000-999-7 which is -6
thank you very much, this was the problem, I added a condition if result is below zero not to deduct -7, but when I do not deduct -7 my indicator does not work at all :D
but I do not know why??
- You should stop using the old event handlers and IndicatorCounted() and start using the new ones.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
How to do your lookbacks correctly. - Keith already pointed the problem.
How to do your lookbacks correctly.
thank you very much William.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have programmed an indicator which includes some function and main calculation is as below the problem is that the indicator does not automatically show the histogram, I have to refresh or change time frames then new histograms appear.
could any one let me know how should I solve this problem?
or is there any function which refreshes the indicator?