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

[amibroker] Re: YTD



PureBytes Links

Trading Reference Links

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


------------------------ 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/