PureBytes Links
Trading Reference Links
|
Brian,
Here is what I use:
//Year to date %change
Newyear = Year();
startValue=ValueWhen(Year()<Ref(Year(),1) ,Close,1);
EndValue1 = ValueWhen( Newyear, Close, 1);
Filter = Newyear;
AddColumn(Year(), "year", 1.0 );
AddColumn(100*( EndValue1 - StartValue )/StartValue, "Percentage change");
AddColumn(startvalue,"start");
AddColumn(EndValue1,"end");
Anthony
----- Original Message -----
From: "Brian" <cadvantag@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, December 09, 2003 10:09 PM
Subject: [amibroker] Re: YTD
> Thanks Joe & Mr. Valley!
>
> I like them both..
>
> Brian
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Joseph Landry" <jelandry@xxxx>
> wrote:
> > Brian - Here's a code fragment that seems to work for me
> > // ---------------------------YTD Performance Calculation
> > EndV = ValueWhen(DateNum()==DateNum(),Close); // Today's Close
> > BegV = ValueWhen(DateNum()==1030102,Close); // Jan/02/03 Close
> > YTD = 100*(EndV-BegV)/BegV;
> >
> > You'll have to start with a trading day, in this case it was Jan
> > 2,2003.
> >
> > Hope this helps. Seems to work for me.
> >
> > JOE
> > --- In amibroker@xxxxxxxxxxxxxxx, "Brian" <cadvantag@xxxx> wrote:
> > > I am trying to get a exploration that calculates the stocks total
> > or
> > > loss year to date (YTD)
> > >
> > > I am using this formula
> > >
> > > YTD = ((EndValue(Close) - BeginValue(Close) * 100) / BeginValue
> > > (Close);
> > >
> > > But I get an error and I don't know how to set it to start on
> > January
> > > 1 and calculate YTD.
> > >
> > > Can someone help me.
> > >
> > > Thanks,
> > > Brian
>
>
>
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.548 / Virus Database: 341 - Release Date: 12/5/2003
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|