PureBytes Links
Trading Reference Links
|
You cannot use ref(X, -Barcount) as this is looking beyond the start
of the data.
last bar is barcount, so barcount-barcount = 0 which does not exist as
barcount starts counting at 1
to get the value of first bar from the last bar of the data use Ref(X,
-(Barcount-1) )
Just remember this will only give a value for the last bar of the chart
Also as already mentioned include the setbarsrequired function
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com
On 07/04/07, Waleed Khalil <waleedkhalil@xxxxxxxxx> wrote:
> Thanks Ara for the fast reply
> i did that also and i still get zero
> the issue is that i need to get the first date in the chart and then get
> the close for the same day for the Foreign stock
>
> SetBarsRequired(100000, 0);
> case30=Foreign ("case30","close ");
> Case30basevalue= Ref (Foreign ("case30","close "), -BarCount);
> Title = " BarCount = " + BarCount + "Case30basevalue =" +Case30basevalue ;
>
>
>
> Ara Kaloustian wrote:
> >
> > Barcount is the last available data loaded, so when you ask for data
> > prior
> > to Barcount bars, there is no data.
> >
> > If you want to load entire data set use
> >
> > SetBarsRequired(1000000,0); at top of program and use a different way of
> > asking for data other than Barcount bars ago
> >
> > This may slow down program.
> >
> > ----- Original Message -----
> > From: "Waleed Khalil" <waleedkhalil@xxxxxxxxx
> > <mailto:waleedkhalil%40gawab.com>>
> > To: <amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>>
> > Sent: Friday, April 06, 2007 2:27 PM
> > Subject: [amibroker] help with ref()
> >
> > > Hi all
> > > Please tell me why the Ref function does not get data more that 260 days
> > > ago,
> > > it returns zero for any period more than 260 days ago
> > >
> > > _SECTION_BEGIN("stockovercase");
> > > case30=Foreign ("case30","close ");
> > > Case30basevalue= Ref (Foreign ("case30","close "), -BarCount);
> > > Title = " BarCount = " + BarCount + "Case30basevalue ="
> > +Case30basevalue
> > > ;
> > > _SECTION_END();
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/
|