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

[amibroker] Re: Calculating % change since 1/3/2006



PureBytes Links

Trading Reference Links

The two formulas appear to give different dates. The first does give
the closing price for 12/30/04 but the second gives the closing price
for 01/03/04 which would be incorrect for year to date figures.

I am also confused as to the +1 and couldn't see how to correct the
line to give the closing '05 price.

DM

--- In amibroker@xxxxxxxxxxxxxxx, "MarketMonk777" <dlittner@xxx> wrote:
>
> 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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of Graham
> Sent: Saturday, March 25, 2006 3:47 PM
> To: amibroker@xxxxxxxxxxxxxxx
> 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 <dlittner@xxx> 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:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/