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

Re: [amibroker] Re: Simple question about BarCount



PureBytes Links

Trading Reference Links

Ok, thanks again. What you are saying is very clear. However, in my case I am writing my own indicators that, for statistical reasons, may need to look back into the price history an arbitrary amount of time. The amount of time is a percentage of the available data in the database. I am not using any AmiBroker functions that have a pre-configured look back requirement (such as a moving average). I require looping over all available data and performing calculations. So, knowing that the BarCount may not have a direct relationship to the number of bars in the database, unless I set it explicitly solves my issue. Using SetBarsRequired seems to work well.  Thanks again.

Tomasz Janeczko wrote:
Hello,

Not necesarily last N bars because you can scroll back to say first year visible from those
20 years and then it would represent first N bars.

As for lookback - it is automatically calculated by AmiBroker based on functions you use.
Use Tools->"CHECK" function in the AFL editor to find out how many bars before first visible
and after last visible are required. It was explained on this group a couple of times already.

For example if your formula is

MA( C, 50 ) > C and MA( C, 150 ) > C;

AmiBroker will use 230 bars PRIOR to first visible bar (200 for averages and 30 "extra" padding that
is always added).

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "oneklema" <andy@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, September 07, 2007 4:42 PM
Subject: [amibroker] Re: Simple question about BarCount


  
Thanks for your quick help Tomasz. So, BarCount represents the last N
bars, where N simply varies depending on the zoom factor.

I understand what you are saying with your example of the 20 years of
data. But also, I can certainly conceive of an indicator (or script)
that may want a "lookback" to be longer than and independent from the
zoom factor. Which is why, I'm sure, there is the SetBarsRequired()
function. 


--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
    
BarCount does not represent number of bars in the DATABASE,
but in the ARRAYs in current execution.

The arrays have DYNAMIC size depending on zoom factor. That's why
      
BarCount may and will vary.
    
For example if you have 20 years of data and you are watching just
the last year
AmiBroker does not need and does not use all bars in the database to
      
calculate 
    
indicators for last year.

It uses last year only PLUS some previous bars required to
      
"stabilise" indicator values.
    
The number of extra bars depends on functions you use in the formula.

If you want to use truly all bars you need to use SetBarsRequired
      
function:
    
http://www.amibroker.com/f?setbarsrequired

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "oneklema" <andy@xxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, September 07, 2007 3:45 PM
Subject: [amibroker] Simple question about BarCount


      
I have what should be a simple question about BarCount but cannot get
a definitive answer from the AB documentation. FYI, I am working on
daily data.

What exactly does BarCount represent? The AB help says:

BarCount constant gives the number of bars in array (such as Close,
High, Low, Open, Volume, etc). Array elements are numbered from 0
(zero) to BarCount-1. 

So, I understand that it is the size of the arrays (I'm an old C
programmer). But, I assumed that if I have a loop such as:
for (i = 0; i < BarCount, i++)
{
  do work on C[i];
}

I would do work on every Close value that is *in the database for the
symbol that is opened*. But, it does not seem to work this way (?).

When I print out the value of BarCount, I notice that it changes as I
change the Zoom factor (i.e., clicking +,-). And, the only way to get
BarCount to reflect all data is to zoom as as far as it can go. So, I
thought maybe it represents the number of bars displayed as adjusted
by the zoom. But, from a visual inspection, it is obviously not that
(maybe related, but not exact). 

Is there any way to operate on symbol data for all data that has been
loaded into the database, regardless of the zoom factor?



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





        


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





    


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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


  
__._,_.___

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




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

__,_._,___