Mortgage calculator code
Part 3
Interest calculations
In part 2 of this Mortgage calculator code series, we finished by dividing the JavaScript mortgage formula into 2 parts:
The first formula finds the real interest rate and the second one finds the periodic payment:
IntRate = AnnualIntRate / PPay
Pa = (PrValue * IntRate) / (1 - Math.pow (1 + IntRate, - Period) )
The interest rate is IntRate, AnnualIntRate is the annual interest rate, PPay is the number of payments per year, Pa represents the payment, PrValue is the present value of the loan, tand Period is the number of years the money is borrowed.
The interest calculations have to take care of 2 things: the compounding period (monthly in the US) and the payment period.
Therefore, the Interest calculations are not exacly as shown above. The real interest rate has to be adjusted to our payment cycle, which implies that we also have to adjust the period to our payment cycle... like this:
IntRate = AnnualIntRate / PPay
Pa = (PrValue * IntRate) / (1 - Math.pow (1 + IntRate, - (Period * PPay) )
If this formula was for monthly mortgage payments, PPay would be 12.
Next topic: Canadian mortgage calculator code
To hard to program? Just click on this link to get 4 ready-to-use JavaScript mortgage calculators for your website or for offline use on your computer!
Mortgage Calculators Products Services Help About Us Site Map
© Copyright (C) 2003-2010 by Dominique Peladeau • 1stop-mortgagecalculator.com.
All Rights Reserved
886 de L'Epee ave., Outremont, QC, H3V 3V3 • (514) 571-9747 (9-5 EST)
Contact us