- Why did you posted in the
Root /
MT5 General section instead of the
MQL4 section?
- How do you compute a five (5) period moving average with only one value?
- And how do you expect to look at the last two values with only one value.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
In the following code why does it return my object AVGVol1 as 0.0 and not the average of volume it should?
I see AVGVol[0] works and returns the volume okay, so this array work as far as I see. But it doesn't work within the iMAOnArray parameter? Why not? Any help on this I would be much appreciated.
{
double AVGVol[1];
AVGVol[0] = (double)iVolume(_Symbol,_Period,1);
//double avgvol = (double)Volume[0];
double AVGVol1 = iMAOnArray(AVGVol,1,5,1,MODE_SMA,1);
double AVGVol2 = iMAOnArray(AVGVol,1,5,1,MODE_SMA,2);
bool risingvol = (AVGVol1 > AVGVol2);
Print(AVGVol1);
}