PureBytes Links
Trading Reference Links
|
Hello,
Again: as written in the user's guide you don't need (and also
should NOT) disable QuickAFL
globally. It is enough to add SetBarsRequired() to the formula
that needs it.
There is a fundamental difference between BarCount and
BarIndex().
BarCount is a NUMERIC variable that holds just one NUMBER (the
count of elements in array).
BarIndex() is a FUNCTION that returns ARRAY representing bar
index.
Just two different things. Different applications,
etc.
BarCount is intended to be used in FOR loops. That's why it
helds actual number of array elements
so you can iterate as follows:for( i = 0; i < BarCount;
i++ )
BarIndex() on the other hand is a faster replacement of
(Cum(1)-1).
LastValue( BarIndex()) does not give you
number of array elements.
There is a following relation between those two:
bi = <FONT
color=#0000ff>BarIndex<FONT
color=#000000>();
BarCount == 1 + <FONT
color=#0000ff>LastValue(bi)-bi[<FONT
color=#ff00ff>0<FONT
color=#000000>];
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
CS
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, November 23, 2003 3:49
PM
Subject: Re: [amibroker] Barcount vs
BarIndex()
Should have read...
And then when trying to find the date of x0 with <FONT
color=#ff0000>BC=BarCount-1,
Title<FONT
color=#0000ff>=WriteVal<FONT
size=2>(LastValue(<FONT
size=2>ValueWhen(BarIndex()==X0, <FONT
size=2>DateTime())), <FONT
size=2>formatDateTime);
Results in an error.
-Corey Saxe
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
CS
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, November 23, 2003 6:32
AM
Subject: Re: [amibroker] Barcount vs
BarIndex()
It would be a help if linearray worked with
barindex input with Quick AFL on.
This works:
y0=<FONT
face=Verdana>LastValue<FONT
size=2>(Trough<FONT
face=Verdana>(<FONT color=#ff0000
size=2>L,<FONT
color=#800080 size=2>4<FONT
size=2>,2<FONT
size=2>));
y1=<FONT
face=Verdana>LastValue<FONT
size=2>(Trough<FONT
face=Verdana>(<FONT color=#ff0000
size=2>L,<FONT
color=#800080 size=2>4<FONT
size=2>,1<FONT
size=2>));
BC=<FONT
face=Verdana>BarCount<FONT
size=2>-1<FONT
size=2>;
x0=<FONT
face=Verdana>LastValue<FONT
size=2>(BC)-50<FONT
face=Verdana size=2>;
x1=<FONT color=#8b0000
size=2>LastValue<FONT
face=Verdana>(BC)-<FONT color=#800080
size=2>10<FONT
size=2>;
This doesn't:<FONT color=#008000
size=2>
y0=<FONT
face=Verdana color=#000000>LastValue<FONT
face=Verdana>(<FONT
size=2>Trough<FONT
color=#000000>(<FONT
size=2>L<FONT
color=#000000>,<FONT
size=2>4<FONT
color=#000000>,<FONT
size=2>2<FONT face=Verdana
color=#000000>));
y1=<FONT
face=Verdana color=#000000>LastValue<FONT
face=Verdana>(<FONT
size=2>Trough<FONT
color=#000000>(<FONT
size=2>L<FONT
color=#000000>,<FONT
size=2>4<FONT
color=#000000>,<FONT
size=2>1<FONT face=Verdana
color=#000000>));
BC=<FONT
face=Verdana color=#ff0000>barindex()<FONT
face=Verdana color=#ff0000>;
x0=<FONT
face=Verdana color=#000000>LastValue<FONT
face=Verdana>(BC)-<FONT
size=2>50<FONT face=Verdana color=#000000
size=2>;
x1=<FONT
size=2>LastValue<FONT
face=Verdana>(BC)-<FONT
size=2>10<FONT
color=#000000>;<FONT
color=#000000>
<FONT
color=#000000>
<FONT
color=#000000>Although both x0 and x1 seem as correct
inputs.
<FONT
color=#000000>
<FONT
color=#000000>Also, using BarCount as:
BC=<FONT
face=Verdana>BarCount<FONT
size=2>-1<FONT
size=2>;
x0=<FONT
face=Verdana>LastValue<FONT
size=2>(BC)-50<FONT
face=Verdana size=2>;
x1=<FONT color=#8b0000
size=2>LastValue<FONT
face=Verdana>(BC)-<FONT color=#800080
size=2>10<FONT
size=2>;
And then when trying to find the date of x0 with BarCount,
Title<FONT
color=#0000ff>=WriteVal<FONT
size=2>(LastValue(<FONT
size=2>ValueWhen(BarIndex()==X0, <FONT
size=2>DateTime())), <FONT
size=2>formatDateTime);
Results in an error.
Since
BarCount returns a number
so different from barindex, debugging is difficult.
I have no idea where the actual bar it is
pointing at. (Bar 410?)
So, I have to remember to turn Quick AFL off when using this
formula.
Thanks,Corey Saxe
----- Original Message
-----
<BLOCKQUOTE
>
<DIV
>From:
Tomasz
Janeczko
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, November 23, 2003 3:57
AM
Subject: Re: [amibroker] Barcount vs
BarIndex()
Hello,
BarIndex() gives true, absolute index of the quotation.
It does not depend on visible area.
BarCount is different. As we can read in the User's
Guide, what's new in AmiBroker:
"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"
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
CS
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, November 23, 2003
12:52 PM
Subject: [amibroker] Barcount vs
BarIndex()
Sheesh,
You'd think I'd have this figured out, as many times
as I've used BarCount but...
BarIndex() doesn't appear to have any relation to
Barcount.
I have 5988 bars loaded and view 255 at a time,
so plot(BarIndex()) shows 5986 but plot(Barcount) shows
410?
Where does the 410 come from?
Description for BarCount in the AFL Reference
Manual is:
"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.
"
Doesn't the 'array' extend from the first bar to the
last bar?
<FONT
color=#0000ff>
The description for BarIndex() is:
"returns zero-based bar number - the
same as Cum(1)-1 but it is much faster than Cum(1) when used in
Indicators"
<FONT
color=#0000ff>
Here's where I derailed:
" LineArray( x0, y0, x1, y1,
extend = 0 )
generates array equivalent to
trend line drawn from point x0, y0 to point x1, y1. <FONT
color=#ff0000>x coordinates are in bars (zero
based)..."
So naturally, I tried:
y0=LastValue<FONT
size=2>(Trough<FONT
size=2>(L<FONT
size=2>,4<FONT
size=2>,2<FONT
size=2>));
y1=LastValue<FONT
size=2>(Trough<FONT
size=2>(L<FONT
size=2>,4<FONT
size=2>,1<FONT
size=2>));
x0=BarIndex<FONT
size=2>()-50<FONT
size=2>;
x1=<FONT
color=#8b0000>BarIndex()-<FONT
color=#800080>10;
Line = <FONT
color=#8b0000>LineArray( x0, y0, x1, y1,
0 );
LineArray didn't like that.
Could someone please expand on the differences and
similarities of BarCount and BarIndex()?
How did BarCount
arrive at 410?
Thanks,Corey Saxe
Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web
page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of
Service. Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend
SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
|