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

RE: [amibroker] annual return calculation, days between dates [REPOST]



PureBytes Links

Trading Reference Links




<SPAN 
class=902014221-27092003>thanks Tomasz, much appreciated. 
<SPAN 
class=902014221-27092003> 
<SPAN 
class=902014221-27092003>any comment about my questions on annual 
return?
<SPAN 
class=902014221-27092003> 
<SPAN 
class=902014221-27092003>dave
<BLOCKQUOTE 
>
  function 
  GetDaysInRange(){ fb = Status("firstbarinrange"); eb 
  = Status("lastbarinrange"); startday = LastValue( ValueWhen( fb, 
  DayOfYear() ) ); startyear = LastValue( ValueWhen( fb, Year() ) 
  ); endDay = LastValue( ValueWhen( eb, DayOfYear() ) 
  ); endYear = LastValue( ValueWhen( eb, Year() ) ); 
   
   Days = 365 * ( endYear - startyear ) + endDay - 
  StartDay; return Days;}""+GetDaysInRange();
  Hope this helps.
   
  Best regards,Tomasz Janeczkoamibroker.com
  <BLOCKQUOTE 
  >
    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? 
    thesework:      start_date = 
    Status("RangeFromDate");      end_date = 
    Status("RangeToDate");  how can I subtract start_date from end_date 
    to get the number of calendardays between them?- the following 
    code, modified from code in the help, computes annual returngiven total 
    equity (e in the code below), but does it in terms of bars, 
    notdays:      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. 
    thereport and I agree exactly on the total return percentage, but not 
    annualreturn. in fact, there's no integ<SPAN 
    class=357172013-26092003>er number of bars in a year that 
    canproduce 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 to12/31/95:      
    Bars (avg. days) in test: 252 (361)  the range in question is an 
    entire year. in purely calendar terms, that's365 days, not 
    361. where does 361 come from? is 
    that related to the reason the 
    above code doesn't agree with 
    the report?






Yahoo! Groups Sponsor


  ADVERTISEMENT 









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 the Yahoo! Terms of Service.