function selective_average(src,len)
{
sum1=0.0; count1=0;
for(i=1;i<BarCount;i++)
{
if (not IsNull(src[BarCount-i]))
{
count1 = count1 + 1;
sum1=sum1+src[BarCount-i];
}
if (count1==len)
{
break;
}
}
mean1 = sum1/len;
return mean1;
}
I'm new to AFL. Above is my AFL code.
I get Error 33. "The identifier is already in use. You attempted to assign value to the identifier representing a function. If you want to return value from a function, you should use RETURN statement instead."
The function as it is posted above does NOT generate any error message. However, the way it is written it does not make sense to me. Maybe you explain in plain English what you really want to achieve.
I identified the error. I was trying to use the same identifier for a different function and it's return variable. It was calling the above function for a calculation and the error got triggered mentioning this function.
Thanks Tomasz for the help. I'm becoming a huge fan of amibroker every further day. It's less than a week since I started. I wish I tried amibroker long back.