Hello,

You don't need to "experiment" - it is all documented.

1.  "In other words, we cant manually overrides the no of bars that AB 
internally decides it needs" 

Wrong. You can override everything.

You are missing the reading exactly in the same way as Fred.
http://www.amibroker.com/kb/2008/07/03/quickafl/

The information you are looking for is written in the "IMPORTANT NOTES" section,
so let me copy it here and highlight the section that you should NOT skip when 
reading:

It is also worth noting that certain functions like cumulative sum (Cum()) by 
default request ALL past bars to guarantee the same results when QuickAFL is 
enabled. But when using such a function, you may or may NOT want to use all 
bars. So SetBarsRequired() gives you also ability to DECREASE the requirements 
of formula. This is done by placing SetBarsRequired at the END of your formula, 
as any call to SetBarsRequired effectively overwrites previously calculated 
estimate. So
if you write

x = Cum( 1 );
SetBarsRequired( 1000, 0 ); // use 1000 past bars DESPITE using Cum()


You may force AmiBroker to use only 1000 bars prior first visible even though 
Cum() by itself would require all bars.

2. Yes it sums requirements. Again, everything is described in document 
mentioned above.  So let me copy it and highlight relevant part

Now, how does AmiBroker know a correct "backward ref" and "forward ref" for the 
entire formula?
Well, every AmiBroker's built-in function is written so that it knows its own 
requirements and adds them to global "backward ref" and "forward ref" each time 
given function is called from your formula.


As to your suggestion - it is already possible via SetBarsRequired placed at 
the end see point 1.

One comment:
that is why I always say: please read carefully as I tend to write short docs 
where every sentence and every word counts and is important.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Paul Ho" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, July 06, 2008 8:50 AM
Subject: [amibroker] Re: AmiBroker 5.14.0 BETA released


> After a bit of experimentation, I can answer most of my own queries
> 1. SetBarsRequired - the backref parameter doesnt change the no of 
> past bars that AB says it needs, but it changes the initial buffer 
> (30 bars). So setbarsrequired(30, -1) has the same effect as 
> setbarsrequired(-1, -1). In other words, we cant manually overrides 
> the no of bars that AB internally decides it needs
> 2. if you enter setbarsrequired(0, 0); and A = MA(c, 50); the check 
> and Profile tells you that you'll need 50 past bars. Fair enough. 
> However, if you also put in B = MA(c, 50), it now says you'll need 
> 100 bars. I can only say that AB always assumes the most pessimistic 
> scenario in calcuating the past bars required. Thats probably 
> explains why I end up with such a large no. for my AFL. while in 
> reality it only uses a fraction of that past data.
> 
> And finally a question to Tomasz if I may, would you consider a means 
> for the more adventurous users to overrides the defaults, In other 
> words, means for me to tell AB I only want a certain number of past 
> bars, sometime in the future.
> 
> Paul.
> 
> --- In [email protected], "Paul Ho" <[EMAIL PROTECTED]> wrote:
>>
>> Hi
>> I have just done some checking on my afls. I have been custom 
> cuting 
>> databases for a few years now to speed up run time. So I know 
>> from experience how much data these afls need before the start 
> date. 
>> In looking at Code Check & profile, One of the AFLs state I need 
> 4342 
>> past bars before the start date, which is approx 20 years of daily 
>> data. I only have approx 18 years. So using QuickAFL wouldnt make 
> any 
>> difference to the execution time. But from experimenting with 
> various 
>> starting date in my custom database, I know that  this afl only 
> needs 
>> 400 bars (1 & 1/2 years) of data before the start date. Obviously, 
>> 400 bars back would make a marked difference in speed (thats why I 
>> started this years ago).
>> I do not know why there is a difference between what AB calculates 
>> and what it actually uses. 
>> I also notice that setting the bars required manually to something 
>> less than what Code and Profile says makes no difference to either 
>> the results (which I would expect to ) or runtime. Is that correct 
>> that setbarsrequired cannot be set to less than What AB calculates?
>>
> 
> 
> 
> ------------------------------------
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
> 
> 
> 

Reply via email to