Monte Carlo_ Importance sampling method
Posted: February 6th, 2008, 11:34 pm
I try to price a call option very out of money using the importance sampling method in Monte Carlo. My results are not what I was expecting but I can't find out the problem_ Here is the code in VBA:Function MCOptionValue5(S0, K, r, T, sigma, c, nsim) Dim rnmut, sum, sum1, S, F, W, W1, payoff1, payoffsqr, Z Dim var1 Dim i As Long Dim nRows As Integer nRows = Application.WorksheetFunction.CountA(Range("B:B")) Randomize rnmut = (r + c - 0.5 * sigma ^ 2) * T sum1 = 0 sum = 0 For i = 1 To nsim W = Application.NormSInv(Rnd) * Sqr(T) W1 = W - (c / sigma) * T S = S0 * Exp(rnmut + W1 * sigma) Z = Exp(0.5 * (c / sigma) ^ 2 * T + (c / sigma) * W1) F = Exp(-r * T) * Application.Max((S - K), 0) payoff1 = F / Z payoffsqr = (F / Z) ^ 2 sum = sum + payoff1 sum1 = sum1 + payoffsqr Next i MCOptionValue5 = sum / nsim var1 = sum1 / nsim - (sum / nsim) ^ 2 Cells(nRows + 14, 6) = var1 End FunctionThank you for your help