When I am using this code, and seeing the exploration, why "i" is always equal to 2464. Why its not starting from 1 and then increasing by 1 on every bar ?
Source: http://www.amibroker.com/kb/2008/07/03/quickafl/
Can you now please answer as "i" is being incremented in the "for" loop what will be the last value of "i" per execution? The same answer is the reason why "i" in your case is 2464 always. Hope it helps!