IFinance.XIrr

Syntax

XIrr(Values: Array; DateTimes: Array; Guess: Double): Double;

Parameters

Parameters Description Constraints
Values A set of cash flows, corresponding to the payment schedule. The first payment is optional and corresponds to the starting investment payment. All the next payments are discounted on the basis of a 365-days year. It is required to use an array of the Double type.
DateTimes A schedule of payment dates, which corresponds to the set of cash flows. The first date is the starting one in the payment schedule. All the other dates must be later than this date, but can have arbitrary order. It is required to use an array of the DateTime type.
Guess Supposed value of the XIrr function result.  

Description

The XIrr method returns internal rate of return for the schedule of cash flows, which do not have to be regular.

Comments

The set of Values must contain at least one positive and one negative value.

The iteration method is used to calculate XIrr. Using the Rate changing rate (starting from the Guess value), the XIrr function makes cyclic calculations until it gets a result with precision to 0.000001 percent. If the XIrr function fails to find the result after 100 attempts, it returns an error. The rate changes until the following equality:

Where:

Example

To execute the example, add a link to the MathFin system assembly.

Sub UserProc;
Var
    r: Double;
    Values: Array[5Of Double;
    Dates: Array[5Of DateTime;
Begin
    Values[0] := -10000;
    Values[1] := 2750;
    Values[2] := 4250;
    Values[3] := 3250;
    Values[4] := 2750;
    Dates[0] := DateTime.parse("01.01.2008");
    Dates[1] := DateTime.parse("01.03.2008");
    Dates[2] := DateTime.parse("01.10.2008");
    Dates[3] := DateTime.parse("15.02.2009");
    Dates[4] := DateTime.parse("01.04.2009");
    r := Finance.XIrr(Values, Dates, 0.09);
    Debug.WriteLine(r);

End Sub UserProc;

After executing the example the console window displays the internal rate of return equal to 0.3882.

See also:

IFinance