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

Re: [amibroker] Barcount vs BarIndex()



PureBytes Links

Trading Reference Links




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 
size=2>(BC)-10<FONT 
face=Verdana>;
 
This doesn't:<FONT color=#008000 
size=2>
y0=<FONT 
face=Verdana color=#000000>LastValue<FONT 
color=#000000>(<FONT 
size=2>Trough<FONT 
color=#000000>(<FONT 
size=2>L<FONT 
size=2>,4<FONT 
face=Verdana>,<FONT 
size=2>2<FONT face=Verdana 
color=#000000>));
y1=<FONT 
face=Verdana color=#000000>LastValue<FONT 
color=#000000>(<FONT 
size=2>Trough<FONT 
color=#000000>(<FONT 
size=2>L<FONT 
size=2>,4<FONT 
face=Verdana>,<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 
color=#000000>(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 
size=2>;<FONT 
color=#008000 size=2>
<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 
size=2>(BC)-10<FONT 
face=Verdana>;
 
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. 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=BarIndex<FONT 
    size=2>()-10<FONT 
    size=2>;
    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. 







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.