1 Stop Mortgage Calculator - Calculate your Mortgage payments in Seconds!
Mortgage Calculator Code - Part 4, Canadian mortgage calculations - 1

# Mortgage calculator code

Part 4

In the third installment of our explanation of this Mortgage calculator code series, we finished by saying that the mortgage formula had 2 parts, the first part was to set the Interest Rate (IntRate)

IntRate = AnnualIntRate / PPay

And the second part was to do the actual mortgage calculations:

Pa = (PrValue * IntRate) / (1 - Math.pow(1 + IntRate, -(Period * PPay)))

### Canadian JavaScript mortgage calculator code

The Canadian mortgages are compounded semi-annually while the US mortgages are compounded monthly. The basic mortgage formula is the same as the previous formula (see part 2), but the interest rate has to be adjusted:

IntRate = Math.pow((1+AnnualIntRate/2),(2/12)) - 1

and then we finish the process with the basic mortgage formula:

Pa = (PrValue * IntRate) / (1 - Math.pow(1 + IntRate, -Period))

This is fine for annual payments, but what about monthly or bi-monthly payments?

Let's find out in our next topic: Canadian JavaScript mortgage formula - part 2

To complex to program? Just click here to purchase 4 mortgage calculators that you can install instantly on your website or for offline use on your computer!