Hi
I am using this function, which works and returns a value, however in the formula output i keep getting a message that
sprice has no properties at line 160, (sum=sum+sprice[i];
function summation(sprice,xlength){
var i=0;
var sum=0;
for (i = 0; i <xlength; i++);{
if (sprice == null);{
sprice = getValue("Close",0,xlength);}
if (sprice[i] != null);{
sum = sum + sprice[i];}
}
return (sum);
}
Anyone know why i get this the following function is the only function that uses this calculation
function averagefc(sprice,length){
if (sprice == 0);{
sprice = new Array(getValue("Close",0,length+1));
}
afcline = (summation(sprice,length))/length;
return(afcline);
}
I am using this function, which works and returns a value, however in the formula output i keep getting a message that
sprice has no properties at line 160, (sum=sum+sprice[i];
function summation(sprice,xlength){
var i=0;
var sum=0;
for (i = 0; i <xlength; i++);{
if (sprice == null);{
sprice = getValue("Close",0,xlength);}
if (sprice[i] != null);{
sum = sum + sprice[i];}
}
return (sum);
}
Anyone know why i get this the following function is the only function that uses this calculation
function averagefc(sprice,length){
if (sprice == 0);{
sprice = new Array(getValue("Close",0,length+1));
}
afcline = (summation(sprice,length))/length;
return(afcline);
}
Comment