hknight:
How can I get the average value of an array?
Add the elements, divide by the number of elements . . . isn't that how you calculate an average ?
int x[5]; x[0]=3; x[1]=7; x[2]=4; x[3]=7; x[4]=9; int ArrayIndex; double ArraySum; for(ArrayIndex = ArraySize(x) - 1; ArrayIndex >= 0; ArrayIndex--) ArraySum += x[ArrayIndex]; Alert("The average value of x is: ", ArraySum/ArraySize(x));
Thanks.
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
How can I get the average value of an array?