October 9th, 2006, 5:07 pm
Hi,I am writing a C++ program for MC simulation and don't seem to be able to get my gamma right. I got the price and delta, but the gamma is way off. Can someone tell me what I am doing wrong? Basically for delta I multiply the spot price by 1.01 and for gamma by 1.02. .......... newspot = spot*exp((intrate_ - 0.5*vol*vol)*expiration); deltanewspot = (spot*1.01)*exp((intrate_ - 0.5*vol*vol)*expiration); gammanewspot = (spot*1.01*1.01)*exp((intrate_ - 0.5*vol*vol)*expiration); .... call some function to generate a series of normal RVs .... loop thru the RVs and stored in vector of doubles the different S(T) prices gbmnode.GBMPrice=newspot*exp(voltime*(*rand_iter)); gbmnode.DeltaGBMPrice=deltanewspot*exp(voltime*(*rand_iter)); gbmnode.GammaGBMPrice=gammanewspot*exp(voltime*(*rand_iter)); ... loop thru the different S(T) prices and calculate the payoff for European call running_sum += max((*gbm_iter).GBMPrice - strike, 0); delta_running_sum += max((*gbm_iter).DeltaGBMPrice - strike, 0); gamma_running_sum += max((*gbm_iter).GammaGBMPrice - strike, 0); ... Average and PV the result prices running_sum = (running_sum / NumOfSim_)*exp(-intrate_*expiration); delta_running_sum = (delta_running_sum / NumOfSim_)*exp(-intrate_*expiration); gamma_running_sum = (gamma_running_sum / NumOfSim_)*exp(-intrate_*expiration); Price = running_sum; Delta = (delta_running_sum - running_sum)/(spot*0.01); Gamma = ((gamma_running_sum - delta_running_sum)/(spot*0.01)) - Delta; //I imagine this is where the problem is?The way I think about how to compute gamma is to increase the spot price 1% and then another 1%, calculate the payoff from delta price, the payoff from gamma price, take the difference bettween the two, normalize by 1 and get the second delta , then subtract from it the first delta, thus the change in delta due to spot price increase. What is wrong here?Thx in advance.