irusoh1 wrote:
First, if you read documentation on passing arrays by reference, I don't believe you can modify a passed array.
Second, isn't there a function called iMAOnArray which gives a moving average of any array?
First, if you read documentation on passing arrays by reference, I don't believe you can modify a passed array.
Second, isn't there a function called iMAOnArray which gives a moving average of any array?
.." I don't believe you can modify a passed array."...
I have modified an InArray and put the result in an OutArray as function above does in title
void MovingAve(
double& OutArray[],
double& InArray[],
double cPeriod,
double limit)
Still would like to see Moving average cod, if possble , thx
'Problem with iMAOnArray; It doesn't function.'
This guys says there is a BUG with iMaOnArray..anyways !
You can modify arrays passed by ref, or at least, I do it...
I guess documentation was updated.
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
I have an array with data that is made up from calculations, I need to find the simple moving average of data in this array..
My code is not working
note : limit is just total records in array. 50 is desired period.
Call the function in Start area >> MovingAve(Array3,Array2,50,limit);
void MovingAve(
double& OutArray[],
double& InArray[],
double cPeriod,
double limit)
{
int k = limit - (cPeriod+5);
double sum, count, m;
for(int i=k; i<=0 ;i--)
{
m = i + cPeriod;
for(int p=i; p>=m ;p++)
{
sum += InArray[i];
count += 1;
}
OutArray[i] = sum/count;
}
*** How do I fix the simple moving average code ???