+ and a loop.
Damian Mateusz Dziadosz:
ok then as i though there no specific function for that i will do what you said thank you so much.
ok then as i though there no specific function for that i will do what you said thank you so much.
Hi,
you could use the following code:
double ArraySum(const double &v[],int _count=WHOLE_ARRAY) {
double s=0.;
if (_count==WHOLE_ARRAY) _count=ArraySize(v);
for (int i=0; i<_count; i++) {
s += v[i];
}
return s;
}
int ArraySum(const int &v[],int _count=WHOLE_ARRAY) {
int s=0.;
if (_count==WHOLE_ARRAY) _count=ArraySize(v);
for (int i=0; i<_count; i++) {
s += v[i];
}
return s;
}
It implements a function ArraySum(array,count) that returns the summation of either the whole given array, if you don't specify the "count" argument, or of its first "count" elements. The two implementations (overloading) are needed to allow to give both a int and a double array.

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
Is there any function in mql4 to get sigma (summation)? I checked in Math functions and could not find it. Thanks in advance