PureBytes Links
Trading Reference Links
|
I may have found the error (or bug?). In the following code:
MaxBar=(BarCount-1);
ChBar=
//BarIndex();
//SelectedValue(BarIndex()-100);
LastValue(Min(MaxBar,SelectedValue(BarIndex())));
printf("\nChBar: " + NumToStr(ChBar,1.0));
printf("\nMaxBar: " + NumToStr(MaxBar,1.0));
ChBar and MaxBar are the same and change both to a new "same" number
if I choose a different bar via the Selector Line.
However, if I change ChBar = LastValue(Min(MaxBar,SelectedValue
(BarIndex())));
into ChBar = BarIndex();
MaxBar stays fixed and returns the index of the last visible bar in
the visible area, whereas ChBar returns the changing bar-index.
Question is: Why?
--- In amibroker@xxxxxxxxxxxxxxx, "vlanschot" <vlanschot@xxx> wrote:
>
> Thx Tomasz,
>
> Although I don't receive it, I get the picture. However, using
> LastValue should mean that WITHIN the same chart-view (i.e. visible
> area), choosing another bar via the Selector Line should not change
> the Maxbar result?
>
> It's shocking I don't get this after so many years. And I'm now
> wondering there is probably no way to get the number of ALL bars
(the
> full history) unless you use all quotes in AA/the chart, or is
there?
>
> PS
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@>
> wrote:
> >
> > Hello,
> >
> > I am sorry, one correction is needed to previously posted picture.
> > Note that BarIndex represents actual QUOTES. So first quote will
> ALWAYS have index of ZERO.
> > Now the AFL array can be MOVING over available quotes if you are
> shifting visible area using scroll bar.
> > As you can see in this example, the barindex() function in
current
> execution will give you numbers starting from 11 upto 23 because
> current
> > visible area covers only part of available quotes.
> >
> >
> >
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message -----
> > From: Tomasz Janeczko
> > To: amibroker@xxxxxxxxxxxxxxx
> > Sent: Thursday, April 17, 2008 3:11 PM
> > Subject: Re: [amibroker] Barcount vs Barindex()
> >
> >
> > Hello,
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message -----
> > From: "vlanschot" <vlanschot@>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Thursday, April 17, 2008 2:05 PM
> > Subject: [amibroker] Barcount vs Barindex()
> >
> >
> > >I always thought that Barcount would give me the number of
bars,
> as
> > > in "LastValue", available for the current active array,
> according to
> > > the manual:
> > >
> > > " . . . BarCount is a numeric variable that holds just one
> number
> > > (the count of elements in array). . ."
> > >
> > > as well as:
> > >
> > > " . . . if you choose range: "all quotes" in AA
> > > SelectedValue function is equivalent to array[ BarCount -
> 1 ] . . ."
> > >
> > > Why is it then that if I use the following code:
> > >
> > > MaxBar=BarCount-1;
> > > ChBar=LastValue(Min(MaxBar,SelectedValue(BarIndex())));
> > >
> > > printf("\nChBar: " + NumToStr(ChBar,1.0));
> > > printf("\nMaxBar: " + NumToStr(MaxBar,1.0));
> > >
> > > I get the same number for ChBar and Maxbar as output in my
> > > Interpretation for a randomly selected bar in the chart:
> > >
> > > ChBar: 640
> > > MaxBar: 640
> > >
> > > If I select another bar, the numbers are again the same:
> > >
> > > ChBar: 881
> > > MaxBar: 881
> > >
> > > Should MaxBar not reflect a fixed number, namely (LastValue
> (BarIndex
> > > ())- "Blank Bars"?
> > >
> > > Or do I need to re-interpreted Barcount as:
> > >
> > > Barcount = SelectedValue(BarIndex())+1; ????
> > >
> > > I use AB 5.08
> > >
> > > Thx,
> > >
> > > PS (Deja-vu-ing, feeling like a beginner again)
> > >
> > >
> > >
> > > ------------------------------------
> > >
> > > 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/
|