PureBytes Links
Trading Reference Links
|
I am trying to calculate the sum of daily volume in a descending
order and I get a run time error with the following code.
EnableScript("jscript");
<%
Vol = VBArray( AFL( "Volume" ) ).toArray();
// perform the loop that calculates Sum of Volume
k = Vol.length;
Sumvol = 0;
for( i = 0; i < k ; i++ )
{
Sumvol = Sumvol + Vol[ k - i ];
}
AFL.Var("Sumvol") = Sumvol;
%>
Filter = C>0;
NumColumns=2;
Column0=Close;
Column1 = Sumvol;
If I change the expression in the for loop to
Sumvol = Sumvol + Vol[ i ];
it works. However, that is not what I want. Any help is appreciated.
Also the following for loop gives an error , I don't know why?
for( i = k; i > k -5 ; i--) -- doesn't seem like i--
thanks
mohan
|