Hi Graham, Thanks, the barssince works. I have added the following lines of code:
BS = BarsSince(Year()!=Ref(Year(),1)); AddColumn(BS,"BS 1-1-06" , 3.2, colorDarkRed, colorLightGrey ); YTD = C - Ref( C, -BarsSince(Year()!=Ref(Year(),1))+1); AddColumn(YTD,"YTD Net" , 3.2, colorDarkRed, colorLightGrey ); Just to confirm that all works. I am confused as to the purpose of the +1 that is added at the end of the code in the YTD line. I was able to research and figure out that != means not equal to. And researched how barssince works. And that ref(year(),1) is the way to catch the year changing from 2005 to 2006. But that +1 has me confused. What is it's purpose? Dave -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Graham Sent: Saturday, March 25, 2006 3:47 PM To: [email protected] Subject: Re: [amibroker] Calculating % change since 1/3/2006 you can use valuewhen function to reference a fixed point or ref with barssince for the close price of end of previous year valuewhen( year()!=ref(year(),1), C ) or ref( c, -barssince(year()!=ref(year(),1))+1) -- 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 3/26/06, marketmonk777 <[EMAIL PROTECTED]> wrote: > Hi folks, > > I would like to add a value to my title line and in some of my > explorations. The value that I am trying to determine is the % change > since the last trading day of 2005 (or should I use 1/3/06?). > > How do I specify a fixed date in my calculations? > > Thanks, > > Dave > > > > > > > > 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 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 <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
