Instruments


The video has already shown the "Import and calculate" method. The "Import" method loads the price directly from the "Price component file". The "Calculate" method does not use this file, the result is calculated from the formula only. 




The "Calculate with selected date" method uses the selected date instead of "Parameter 5". The default value of the selected date is the current day. 

Amortization

In the formula p1, p2, p3 are numbers, p4 and p5 are dates. 
Let's say you bought a flat for $18 000. Store this value in p1. You estimate that the monthly amortization is $30, write this into p2. The date of the purchase is November 16, 2018, which can stored in p4. To calculate the current price you can use this formula.
p1 - Math.Abs(12 * (p5.Year - p4.Year) + p5.Month - p4.Month) * p2
Where p5.Year is the year component of the current date. Math.Abs calculates the absolute value of its parameter, the elapsed time from the purchase in months. The initial value is decreased by $30 in each month. Of course the result can be modified directly or you can change the formula or the parameters.

Interest

Let's say that you have a fixed term deposit starting at November 16, 2018. You store this value in p4. The interest rate is 2.6% which appears in p2 as 0.026. You have two options. You can take into account the interest only at the very end or you can say the price of your deposit increases in each day.  You have  chosen the second option. To calculate the current price you can use this formula.
p2 / 365 * (p5 - p4).Days + 1
Where p2 / 365 is the interest for one day,(p5 - p4).Days is the elapsed time, the difference of the current day and the start date in days. + 1 is the initial capital.

Previous Post Next Post

Contact Form