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

[amibroker] Re: Barcount vs Barindex()



PureBytes Links

Trading Reference Links

Thanks Bill, but according to the manual this is allowed:

MIN
- minimum value of two numbers / arrays 

SYNTAX  min( ARRAY1, ARRAY2 )  
RETURNS ARRAY  
FUNCTION  Returns the smallest of the two parameters.  
EXAMPLE The formula "min( CLOSE, 10 )" returns the closing price or 
10, whichever is less. The formula "min(-14, 13)" always returns -
14.  

In other words, I already make sure that the array MIN returns by 
default (even if you use two numbers as inputs) is transformed into a 
scalar/number by using LastValue(Min. . . .)

Any other thoughts appreciated.

PS
--- In amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@xxx> 
wrote:
>
> You are mixing up numbers and arrays (see Users Guide).  Check the 
syntax for the functions used.  Min() requires two arrays and not two 
numbers - maxbar and selectedvalue(barindex()) are numbers.
> 
> Bill
> 
> ----- Original Message ----- 
> From: "vlanschot" <vlanschot@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, April 17, 2008 8:05 AM
> 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
> > 
> > 
> > 
> > 
> > 
> > -- 
> > No virus found in this incoming message.
> > Checked by AVG. 
> > Version: 7.5.524 / Virus Database: 269.23.0/1381 - Release Date: 
4/16/2008 9:34 AM
> > 
> >
>



------------------------------------

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/