I wrote a program to price European option. The program is not showing any error but not giving price also.
The function (boptvol) is expected to price a European option taking Stock (stock), age (time), volatility (vol), interest rate (int), contractual expiry (expn), type of payoff (payoff),Strike ( strike), number of asset steps used for evaluation option (nas) using finite difference method. I am expecting function to return price of the option based stock price and age (if option is bought today age is zero).Can anybody opine where I am going wrong.
Just to give some extra color about the code. Table d2 in the code is designed to store value of option at all the grid points of finite difference grid. Table d1 is used to generate stock price which are used for computation in table d2. Table d3 is used to store time steps.
European option price is give by euro. euro takes one of the values in table d2 if stock price is exactly same as one of the values in table d1 and timestep is exactly same as one of the values in table d3, otherwise it uses black sholes PDE to generate option price from immediate nodes of table d2.
Any help in debugging code will be very useful.
Regards
Attachments: