Herman -

Bottom line - do the following - explanation follows -

//  The following yields a QuickAFL array index
bi = BarIndex();
bi = bi - bi[0];

//  Now the loop
end = SelectedValue(bi);
start = end-100;
for (i=start; i<=end; i++)
{
}
// NOTE - assumes at least the following
SetBarsRequired(100,0)

To see how this works is a little tough without pictures, but envision
the following -

    * Ticker contains 5000 bars
    * Last 1000 bars displayed
    * SetBarsRequired(100,0) has been used
QuickAFL is going to present arrays as 1100 bars (1000 displayed+100
back).  The trick is that the BarIndex() function returns the bar index
for the full data.  So, it returns values 3900 - 4999 in the BarIndex()
array that you "see" in AFL.  You have to convert it to a QuickAFL index
that you can use for looping by subtracting the "bias amount" of the
first bar.

See Tomasz's much better explanation at -

http://www.amibroker.com/kb/index.php?s=quickafl

-- BruceR

Reply via email to