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

[amibroker] annual return calculation, days between dates



PureBytes Links

Trading Reference Links

I'm adding annual return to an indicator, and I have some questions:

- how can I find out the number of days (NOT bars) in the AA range? these
work:
	start_date = Status("RangeFromDate");
	end_date = Status("RangeToDate");
  how can I subtract start_date from end_date to get the number of calendar
days between them?

- the following code, modified from code in the help, computes annual return
given total equity (e in the code below), but does it in terms of bars, not
days:
	bars_in_test = Cum(Status("BarInRange"));
	bars_in_year = 252;
	e_ann_rtn_pct = ( (e / initial_equity) ^ (bars_in_year / bars_in_test) - 1)
* 100;
  it's close to what I see in the AA report window, but not exact. the
report and I agree exactly on the total return percentage, but not annual
return. in fact, there's no integral number of bars in a year that can
produce the annual result I see in the report.
  how is this supposed to be done?

- why does the AA report window say this for a date range of 1/1/1995 to
12/31/95:
	Bars (avg. days) in test: 252 (361)
  the range in question is an entire year. in purely calendar terms, that's
365 days, not 361. is that related to the reason the above code doesn't
agree with the report?

thanks,


Dave Merrill


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