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

[amibroker] Re: Newbie questins



PureBytes Links

Trading Reference Links

Graham

Do you know how can I get the first date for which we have data (end 
of the day)?

Thanks

Cam



--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> this will get you the value on a chart
> 
> x = SelectedValue(DateNum());
> 
> 
> -- 
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
> 
> 
> On 20/08/06, Terry <MagicTH@xxx> wrote:
> >
> >  Here's some code.
> >
> >
> >
> > In the Title statement, the date of the first bar of data is x[0]
> >
> > Note that this requires the SetBarsRequired due to quickAFL. 
(This gets
> > you the actual first date of the symbol data up to ~400 years 
ago for daily
> > bars.)
> >
> >
> >
> > y is, in fact, the date for one year ago. You can see it in the 
chart
> > title.
> >
> > z "should be" the one year ago price, actually it is now looking 
for how
> > many bars since the date one year ago, but it does not work. 
Whenever I try
> > to do a compare or a ValueWhen using DateNum(), BarIndex() or 
BarsSince() I
> > get empty values for the result. If you find a way, note to use 
<= rather
> > than == in case the date one year ago is a weekend or other non-
trading
> > date.
> >
> >
> >
> > *Any wizards out there that can solve this problem?*
> >
> >
> >
> > SetBarsRequired(100000,0);
> >
> > x = DateNum();
> >
> > y = x - 10000; //one year ago date
> >
> > z = BarsSince(DateNum() <= y);
> >
> > zC = Ref(*C*,-z);
> >
> >
> >
> > *Title* = "\nfirst date: " + NumToStr(x[0],1.0)
> >
> >  + "\none year ago date: " + NumToStr(y,1.0)
> >
> >  + "\none year ago price: " + NumToStr(zC,1.2)
> >
> >  + "\ncurrent price: " + *C*;
> >
> > --
> >
> > Terry
> >
> >
> >
> > -----Original Message-----
> > From: amibroker@xxxxxxxxxxxxxxx 
[mailto:amibroker@xxxxxxxxxxxxxxx] On
> > Behalf Of tipequity
> > Sent: Saturday, August 19, 2006 17:50
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Re: Newbie questins
> >
> >
> >
> > Thanks, Terry for quick response. I am looking for exact year 
ago.
> >
> > Any idea on the second question?
> >
> >
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@> wrote:
> >
> > >
> >
> > > For approximate year ago date you can just use Ref(C,-252)
> >
> > >
> >
> > > For exact year ago date...sorry, I tried several things and 
can't
> >
> > make
> >
> > > it work either!
> >
> > > --
> >
> > > Terry
> >
> > >
> >
> > > -----Original Message-----
> >
> > > From: amibroker@xxxxxxxxxxxxxxx 
[mailto:amibroker@xxxxxxxxxxxxxxx]
> >
> > On
> >
> > > Behalf Of tipequity
> >
> > > Sent: Saturday, August 19, 2006 16:11
> >
> > > To: amibroker@xxxxxxxxxxxxxxx
> >
> > > Subject: [amibroker] Newbie questins
> >
> > >
> >
> > > 1. how can refer to a calendar year ago prices (end of the 
day), I
> >
> > > tried the following and it did not work:
> >
> > >
> >
> > > CloseAYearAgo = Ref(C,Year()-1);
> >
> > >
> >
> > > 2. how can I get the first date for which we have data (end of 
the
> >
> > day)
> >
> > >
> >
> > > thanks
> >
> > >
> >
> > > Cam
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > > 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 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 other support material please check also:
> >
> > http://www.amibroker.com/support.html
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >     http://groups.yahoo.com/group/amibroker/
> >
> >
> >
> >     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> >
> >
> >
> >     http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >
> >
> >  
> >
>