<h2 align=center>Web Site of Robert John Morton</h2> <h3>JavaScript: <big>Compound Gain Calculator</big></h3> <blockquote><p align=justify><i> This program calculates the daily, monthly and annual gain for an account where interest accrues daily and where you always leave yesterday's interest in the account so it becomes part of today's capital that generates today's interest. </i></p></blockquote> <form name="gains"> <table cellpadding="4" cellspacing="0" align="center"> <tr> <td></td> <td align="center" bgcolor="#B0C0D0">Annual</td> <td align="center" bgcolor="#E0D0C0">Monthly</td> <td align="center" bgcolor="#B0C0D0">Daily</td> </tr> <tr> <td align="right" bgcolor="#E0D0C0">Percentages</td> <td align="right" bgcolor="#B0C0D0"><input name="ap" size="17" maxlen="20" onChange="updateAnnualPercentage()"></td> <td align="right" bgcolor="#E0D0C0"><input name="mp" size="17" maxlen="20" onChange="updateMonthlyPercentage()"></td> <td align="right" bgcolor="#B0C0D0"><input name="dp" size="17" maxlen="20" onChange="updateDailyPercentage()"></td> </tr> <tr> <td align="right" bgcolor="#E0D0C0">Multipliers</td> <td align="right" bgcolor="#B0C0D0"><input name="a" size="17" maxlen="20" onChange="updateAnnualMultiplier()"></td> <td align="right" bgcolor="#E0D0C0"><input name="m" size="17" maxlen="20" onChange="updateMonthlyMultiplier()"></td> <td align="right" bgcolor="#B0C0D0"><input name="d" size="17" maxlen="20" onChange="updateDailyMultiplier()"></td> </tr> </table></form> <p align=justify>Enter a sensible percentage or a multiplier into one of the fields and then click the mouse somewhere in the coloured area (not in an entry field). The program should then calculate and display the corresponding figures for the other fields. As well as being useful for compound interest, this calculator should also serve well as a rough guide when trying to correlate the different ways people quote share performance. However, shares do not gain (or lose) the same amount every day over a year, so the program can calculate only a <em>mean</em> daily gain from an annual or monthly figure. <p align=justify>By default, the program assumes that gain is accrued for every day of every month of the year. However, if you are working with generators that only produce gain on trading days, then you need to enter the number of actual <em>trading</em> days in a month and a year, which I think is usually 261 per year and 21 per month. <form name="days"> <table cellpadding="4" cellspacing="0" align="center"> <tr> <td align="right" bgcolor="#B0C0D0">Number of gain-bearing days in a year: </td> <td align="right" bgcolor="#E0D0C0"><input name="dpy" size="5" maxlen="5" onChange="updateDaysPerYear()"></td> </tr> <tr> <td align="right" bgcolor="#B0C0D0">Number of gain-bearing days in a month: </td> <td align="right" bgcolor="#E0D0C0"><input name="dpm" size="5" maxlen="5" onChange="updateDaysPerMonth()"></td> </tr> </table></form> <p align=justify>To compute monthly gain from a quoted annual gain, the program calculates the 365th root of the annual inflation multiplier and then raises this to the 30th power. To compute annual gain from a quoted monthly gain, the program calculates the 30th root of the monthly inflation multiplier and then raises this to the 365th power. Of course these roots and powers will be different if you enter different numbers for trading days in the year and the month. <hr> <table><tr> <td><a href=gaincalc_br_frame.htm target=_top><img src=../../../images/brazil.gif width=48 height=31 border=0></a></td> <td>&copy; January 2004 Robert John Morton <br>Clique na bandeira para ler em Português.</td> </tr></table>