PureBytes Links
Trading Reference Links
|
Not sure if this is what you are looking for, but this code generates a line
indicating "bar"-compounded interest up & down. (assumes 260 bars per
"annum")
barvisible = Status("barvisible");
firstvisiblebar = barvisible AND NOT Ref( barvisible, -1 );
period=BarsSince(firstvisiblebar==1);
FirstBar = Ref(C,-period);
ChartStart=Ref(DateNum(),-period);
// % per annum, 1.00 = 100%
percent = Param("ann %", 1.50, 1.0, 2.0, 0.05);
dailyperc = exp(log(percent)/260);
Lineup = FirstBar * (dailyperc)^(Cum(barvisible));
LineDown = FirstBar / (dailyperc)^(Cum(barvisible));
Plot(C, "price", colorRed, styleCandle);
Plot(LineUp, "lineUp", 37, styleLine);
Plot(LineDown, "lineDown", 37, styleLine);
----- Original Message -----
From: "Sidney Kaiser" <s9kaiser@xxxxxxxxxxx>
To: <AmiBroker@xxxxxxxxxxxxxxx>
Sent: Monday, December 08, 2003 1:49 PM
Subject: [amibroker] compound interest
> No nibbles on help for this so far.
>
> It seems to me that the time periods have to be bar by bar to generate the
> interest curve so here is my current attempt which always returns a single
> value, 1.
>
> Where should I go from here?
> Sid
>
> // Compound Interest
>
>
> interest_rate = 5; // %
> //P = 1; // principal amount
> r = interest_rate/100;
> //t = 10; // years
> //tbar = t/260;
>
> A[0] = 1; /*Initialize the first element here*/
> t[0] = 0;
>
> for(i = 1; i<BarCount; i++)
> {
> A[i] = A[i-1]*exp(r*t[i]/260);
> }
> //A = P * exp(r*t);
>
> Plot(A, "Compound Interest", colorBlack, styleLine);
>
>
> 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.545 / Virus Database: 339 - Release Date: 11/27/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/
|