I have written a script for showing Monte Carlo Price for a increasing N. But comparing with BS results , This indicates a huge difference. Where is the error?
Function :
function [cpay,ppay] = callput(S0,K,T,r,sigma,N) %CALLPUT Summary of this function goes here % Detailed explanation goes here phi=normrnd(0,sigma,[1,N]); dT=T; for i=1:N S(i)=S0*exp((r-.5*sigma.^2)*dT + sigma*sqrt(dT)*phi(i)); C(i)= exp(-r*T)*max(S(i)-K, 0); P(i)=exp(-r*T)*max(K-S(i), 0); end price1=sum(C)/N; price2=sum(P)/N; cpay=price1; ppay=price2; end
Main Script:
clc clear all % f=fopen('CPData.txt','w'); [BSCall, BSPut] = blsprice(5,5,.04,.5,.2) fprintf('i\tMC-Call\tMC-Put\n'); for i=1:50 [cpayoff,ppayoff]=callput(5,5,.5,.04,.2,i*1000); cp(i)=cpayoff; pp(i)=ppayoff; fprintf('%d\t%3.4f\t%3.4f\n',i*1000,cp(i),pp(i)); end
Results :
BSCall = 0.3314 BSPut = 0.2323 i MC-Call MC-Put 1000 0.0894 0.0333 2000 0.0838 0.0344 3000 0.0842 0.0331 4000 0.0847 0.0335 5000 0.0852 0.0349 6000 0.0842 0.0330 7000 0.0865 0.0326 8000 0.0844 0.0348 9000 0.0862 0.0329 10000 0.0863 0.0340 11000 0.0859 0.0323 12000 0.0849 0.0346 13000 0.0852 0.0346 14000 0.0861 0.0342 15000 0.0863 0.0325 16000 0.0854 0.0338 17000 0.0839 0.0342 18000 0.0844 0.0340 19000 0.0861 0.0343 20000 0.0845 0.0338 21000 0.0836 0.0341 22000 0.0842 0.0340 23000 0.0853 0.0338 24000 0.0842 0.0341 25000 0.0844 0.0344 26000 0.0863 0.0329 27000 0.0846 0.0332 28000 0.0845 0.0335 29000 0.0852 0.0339 30000 0.0854 0.0334 31000 0.0849 0.0339 32000 0.0851 0.0337 33000 0.0846 0.0340 34000 0.0849 0.0334 35000 0.0850 0.0335 36000 0.0846 0.0339 37000 0.0855 0.0337 38000 0.0851 0.0335 39000 0.0849 0.0335 40000 0.0855 0.0330 41000 0.0853 0.0330 42000 0.0847 0.0337 43000 0.0849 0.0330 44000 0.0850 0.0343 45000 0.0850 0.0338 46000 0.0856 0.0337 47000 0.0846 0.0335 48000 0.0854 0.0337 49000 0.0851 0.0334 50000 0.0853 0.0336