Hello,

I have a script to determine an implied volatility for an options chain. It will retun the Implied Volatility by testing each price series. However if there is not an exact mach it won't return anything. Is there a way I can get the closes match insted for just nothing....

$index = 0.001;
for ($alpha = 0.001; $alpha <= 5.000; $alpha += 0.001)
{
$OptPrice = number_format($row['Ask'],2);
if (number_format(BSCall($stockprice,$row['Strike'],0.0201,$alpha,$daysleft),2) == $OptPrice) break;
$index++;

}

    Write a Reply...