I am not able to calculate IRR. I am usign Microsoft.VisualBasic to calculate IRR. Here is a case:
using Microsoft.VisualBasic;
...
static void Main(string[] args)
{
double[] tmpCashflows = new double[] {
-480117.0,
4471.5158140594149,
6841.5950239895265,
6550.383550359461,
6295.8611873818609,
6074.6070899770129,
5883.532880960287,
6006.9907860976427,
6133.1633945923877
,6262.1156759885489
//,6393.9143799520116
};
decimal irr = 0;
try
{
double tmpIrr = Financial.IRR(ref tmpCashflows);
...
}
catch (Exception ex)
{
irr = 0;
}
}
It gives exception of type "Argument is not valid" (at Microsoft.VisualBasic.Financial.IRR(Double[]& ValueArray, Double Guess)). However, this doesn't show any errors if I do calculations inside Excel.