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

[amibroker] BarCount problem... (Was: Re: Strange behavior...)



PureBytes Links

Trading Reference Links

Thanks, that was it.

Yes, I knew BI and BC are different. I was just demonstrating that BI 
crossed BC, which I wasn't expecting. One more question.. I see the 
right behavior by either turning QuickAFL off or by setting bars 
required to a high value. Is one better than the other, given that I 
must loop over BarCount to feed values in the array?

TIA,

Jitu


--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> No these two are not the same.
> BarIndex() is an index of current QUOTE bar
> - ARRAY. It is equivalent to Cum(1)-1. This counts
> bars from the very first bar to the very last bar.
> 
> BarCount is a CURRENT SIZE of array (single NUMBER)
> 
> In Indicator Builder the arrays used for calculations
> may be SMALLER than number of quotes when QuickAFL feature is 
enabled.
> 
> Enable QuickAFL(tm) for indicators - this turns on QuickAFL(tm) 
feature that causes faster charts redraws. QuickAFL works so it
> calculates only part of the array that is currently visible. If you 
use this feature and your formulas are script based you should
> add SetBarsRequired function to your code. Recommended especially 
when you work with data that have more than 10000 bars. Note: for
> certain indicators requiring recursive calculation, enabling this 
feature may lead to small (less than 0.05%) differences in values
> of indicators (not visible for the eye), due to the fact that not 
all bars available are included in the calculation.
> 
> See also comment to BarCount in "what's new section":
> - added built-in constant 'BarCount' that returns number of bars 
available in arrays (the number of elements of array)
> When QuickAFL is turned on it may be less than true number of bars 
because QuickAFL feature attempts to use only visible bars (and
> few before). You can control how many bars the formula requires 
using SetBarsRequired() function
> 
> 
> And see this too: http://www.amibroker.com/guide/afl/afl_view.php?
name=SETBARSREQUIRED
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "jtelang" <jtelang@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, September 14, 2003 8:09 PM
> Subject: [amibroker] BarCount problem... (Was: Re: Strange 
behavior...)
> 
> 
> > TJ,
> >
> > The problem I'm experiencing seems to be related to BarCount's 
value.
> > I'm seeing following behavior with multiple databases.
> >
> > If I plot BarIndex() and BarCount values (with default DB that 
came
> > with the install) as -
> >
> > Plot(BarIndex(), "BI", colorBlue);
> > Plot(BarCount, "BC", colorRed);
> >
> > - what I see is that BC starts with 159 at the start of the chart,
> > increases by 1, until it reaches 189 and stays there. In the
> > meanwhile, BI starts with zero, crosses BC at 189, and goes all 
the
> > way to 356.
> >
> > Isn't BC always supposed to be 357? Do you have any idea what 
could
> > be causing this? Like I said, I see similar behavior with any DB 
that
> > I use. I'm using 4.41 Beta (built on 9/2).
> >
> > Another interesting thing to note is that when I insert this
> > indicator, BC does show 357 as the value, but as soon as I click
> > anywhere in the chart, it shows the values as described above.
> >
> > TIA.
> >
> > Jitu
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "jtelang" <jtelang@xxxx> wrote:
> > > Typo in the pseudo-code. It should read -
> > >
> > > -------
> > >
> > > handle = LoadTableAndGetHandle();
> > > col = GetWhichColToDisplay();
> > > val = 0; // Value to display
> > >
> > > for( i = 0; i < BarCount; i++ ) {
> > >   val[i] = GetValFromTable(handle, i, col); // i being the row
> > > }
> > >
> > > ------
> > > --- In amibroker@xxxxxxxxxxxxxxx, "jtelang" <jtelang@xxxx> 
wrote:
> > > > TJ,
> > > >
> > > > I'm using a ABTool-managed, externally stored table to store 
some
> > > > calculated data for each symbol. When I try to display a 
value in
> > > the
> > > > column from an indicator, I see a rather strange behavior. 
Say my
> > > > indicator is something like following pseudo-code -
> > > >
> > > > ----------
> > > >
> > > > handle = LoadTableAndGetHandle();
> > > > col = GetWhichColToDisplay();
> > > > val = 0; // Value to display
> > > >
> > > > for( i = 0; i < BarCount; i++ ) {
> > > >   val = GetValFromTable(handle, i, col); // i being the row
> > > > }
> > > >
> > > > -----------
> > > >
> > > > When I first time insert this indicator, a plot gets created 
with
> > > > values shown. However as soon as I click somewhere else in the
> > > chart,
> > > > all values displayed drop to zero (may be because I 
initialized
> > it
> > > to
> > > > zero?). Then onwards, if I click "Edit Formula" again and hit
> > > Apply,
> > > > the values flash on the chart for a fraction of a second, and
> > then
> > > > disappear.
> > > >
> > > > I'm not sure if this is ABTool problem (I've posted a 
question on
> > > > their list to figure out what the best way to display the 
values
> > > is),
> > > > but what could cause the chart to behave this way? I've tried 
a
> > > > number of things, such as defining handle as "handle[0]" to 
see
> > if
> > > it
> > > > loads the file only once, or just loading it inside the loop 
only
> > > > when "i == 0" and then reusing the handle value, etc, but to 
no
> > > avail.
> > > >
> > > > Any ideas?
> > > >
> > > > TIA,
> > > >
> > > > Jitu
> >
> >
> >
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > --------------------------------------------
> > Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/
> >
> >
> >


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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