If I set detrender[i] = 1.3100 or some other constant, then the indicator plots without any issues. However, when I make any references to the smooth array, it won't show any values. How do I get this value to calculate properly?
Just for testing try declaring the smooth array as smooth[2000] instead of as you've probably done; smooth[]
You can't use a variable to set array length:
NO: int someArray[c];
YES : int someArray[40];
to resize the array:
int someArray[];
ArrayResize(someArray, 44);
or
ArrayResize(someArray, someCounterVariable);
You can't use a variable to set array length:
NO: int someArray[c];
YES : int someArray[40];
to resize the array:
int someArray[];
ArrayResize(someArray, 44);
or
ArrayResize(someArray, someCounterVariable);
the ArraySize was never declared. I simply declared:
double detrender[];
then set that value according to what you see in the code at the top.
Your original array had a length (size) of 0, therefore it had no elements to hold your values.
The MQL4 editor is a fairly simple and limited one. In more 'serious' enviroments you would
get an errormessage like " Out Of Bounds Exception" when trying to access non-existent array elements...
MQL4 just keeps you guessing, there are serveral issues like this in the editor/compiler.
If you know the size of the array upon declaration then set its size explicitly, like smooth[8].
Otherwise resize it when its size is known, like jmca says above..
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
If I set detrender[i] = 1.3100 or some other constant, then the indicator plots without any issues. However, when I make any references to the smooth array, it won't show any values. How do I get this value to calculate properly?