i guess this maybe your problem, the code itself looks correct to me and should work even without the following solution, but i suggest you give it a try
|
you should use
ArraySetAsSeries(ADX_bull,true);
Meikel...i tried this...
for (i=0; i<25; i++)
{
ArraySetAsSeries(ADX_bull,true);
ADX_bull[i] = (iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,i));
}
double ADX_bull_current = ADX_bull[0];
Now when i comment ADX_bull_current, it sets it equal to 0, which I assume means it is throwing off an error?
I am not sure what I am doing wrong with the following code:
I am trying to fill an array with a built in custom, and then call the individual array elements after the array has been filled. What am I doing wrong?
Here is my code:
<code>
for (i=0; i<25; i++)
{
ADX_bull[i] = iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,i);
}
double ADX_bull_current = ADX_bull[0];
</code>
Thanks for any help :)
~Cal
Silly question; but as you don't show it, is your array defined as a double?
whocares
Meikel...i tried this...
for (i=0; i<25; i++)
{
ArraySetAsSeries(ADX_bull,true);
ADX_bull[i] = (iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,i));
}
double ADX_bull_current = ADX_bull[0];
Now when i comment ADX_bull_current, it sets it equal to 0, which I assume means it is throwing off an error?
ArraySetAsSeries(ADX_bull,true); not in the loop - before entering the loop
ArraySetAsSeries(ADX_bull,true); for (i=0; i<25; i++) { ADX_bull[i] = (iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,i)); }
I did that and still no luck? This is frustrating...why in the world wouldn't this stupid stuff work? I remove the array, set the equation equal to another variable, and it works just fine...why won't it work in an array in an expert advisor? :(
i really dont know.
sometimes the mql4 compiler does strange things.
try to find a workaround.
even in perl or php there are some bugs, this can happen in every language.
good luck
I figured it out.
I was under the impression that when you declared an array (ie "double ADX_bull[];"), you didn't have to declare the dimensions of the array. I added the dimensions of the array to the declaration and it now works. Thanks to everyone for their help though!
- 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 am not sure what I am doing wrong with the following code:
I am trying to fill an array with a built in custom, and then call the individual array elements after the array has been filled. What am I doing wrong?
Here is my code:
<code>
for (i=0; i<25; i++)
{
ADX_bull[i] = iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,i);
}
double ADX_bull_current = ADX_bull[0];
</code>
Thanks for any help :)
~Cal