about FOR in amibroker

#1
I confuse with amibroker FOR function

let say, i want to add volume from all data i have

program is

------

At = 0;


for (it = 0; it <= (BarCount-1); it++)
{
At = At + V[it] ;
hitungX[it] = At;

};

Plot(HitungX,"all volume",colorRed,styleLine);

--------

I have data from 2005 to 2011

and now, I only show data from jan 2011 to des 2011 chart.

my program will show all the volume.

let say the HitungX at january 5, 2011 is 100.000

but when i change mydata from may 2009 - may 2011 (slide the chart left), the HitungX data change to other value.

how come this happen ?

i have iterated volume from the first bar.
so why if i slide my data time frame, the HitungX at januari 5,2011 value change ?

where is error ?

the program i want to make is, to sum (later, i will add/subtract/multiply/other operation) all the volume from the first bar to last bar.

thanks.
 

Similar threads