MIrr(Values: Array; FinanceRate: Double; ReinvestRate: Double): Double;
MIrr(Values: System.Array; FinanceRate: double; ReinvestRate: double): double;
Parameters | Description | Constraints |
Values | An array, containing the numbers, for which internal rate of return has to be calculated. | It is required to use an array of the Double type. |
FinanceRate | Interest rate for money used in cash flows. | Cannot be equal to 0. |
ReinvestRate | Interest rate for cash flows in case of their reinvestment. |
The Mirr method returns modified internal rate or return for a set of periodic cash flows.
Values must contain at least one positive and one negative value.
Mirr is calculated using the following formula:
Where:
n. The quantity of numbers in the Values argument.
f. The FinanceRate parameter.
r. The ReinvestRate parameter.
NPV(Rate,Values). Net present value of the investment based on set parameters.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r: Double;
Arr: Array[3] Of Double;
Begin
Arr[0] := -1;
Arr[1] := 1.5;
Arr[2] := 2.5;
r := Finance.MIrr(Arr, 0.15, 0.1);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays modified internal rate of return equal to 1.0372.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.MathFin;
…
Public Shared Sub Main(Params: StartParams);
Var
r: double;
Finance: FinanceClass = New FinanceClass();
Arr: Array[3] Of Double;
Begin
Arr[0] := -1;
Arr[1] := 1.5;
Arr[2] := 2.5;
r := Finance.MIrr(Arr, 0.15, 0.1);
System.Diagnostics.Debug.WriteLine(r);
End Sub;
See also: