[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: A simple loop, but not so simple?



PureBytes Links

Trading Reference Links

Title: Re: [amibroker] Re: A simple loop, but not so simple?


Thank you Bruce, now i see it it looks kind of familiar :-)


Thanks also for the link to Tomasz's Quick-AFL facts, that is the one I was looking for. I had searched the KB but nothing turned up.


Nice to have you on board ;-)


have a great day,

herman



Monday, July 13, 2009, 9:47:08 AM, you wrote:


>



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






__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___