However, why can't I use extern int in this indicator???
This morning I wasted one hour with a - may be - similar issue. But in my case, I was the problem.
I've coded a very simple indicator while it stayed in use in the chart of MT4. While doing that, I changed the default-Value of a indicator-variable but forgot to change it in the chart. So the indicator was still working with a very different and earlier value than I have expected through my code. It was to easy to look at the value debbuging. Because I've read your topic before, I thought mine is the same story.
So, long story short: Is it possible that you are testing with an old and wrong value in your 'range' ?
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.
Unexpectly, I find out the problem by amending the line from
ma[i] = iMAOnArray(length,0,range,0,MODE_SMA,i);
to
ma[i] = iMAOnArray(length,0,1,0,MODE_SMA,i);
and the result is now correct!
However, why can't I use extern int in this indicator???
Where did you set length to be a series array (zero being the newest?)
I wonder if anyone has ever found that an indicator buffer is not automatically set as series?
I know that the documentation states that buffers are non-series by default, but that is not the case.
I wonder if anyone has ever found that an indicator buffer is not automatically set as series?
I know that the documentation states that buffers are non-series by default, but that is not the case.
....
However, why can't I use extern int in this indicator???
This morning I wasted one hour with a - may be - similar issue. But in my case, I was the problem.
I've coded a very simple indicator while it stayed in use in the chart of MT4. While doing that, I changed the default-Value of a indicator-variable but forgot to change it in the chart. So the indicator was still working with a very different and earlier value than I have expected through my code. It was to easy to look at the value debbuging. Because I've read your topic before, I thought mine is the same story.
So, long story short: Is it possible that you are testing with an old and wrong value in your 'range' ?