I tried to implement Matlab program computing the price of the European down and out call option using Monte Carlo and Euler discretization scheme. I have initial price S0=50, strike K=50, barrier level B=45 and time of expiration 6 months. The final price I obtain is very small(0.005). Even when I increase T to 1 or when I decrease the barrier, the price doesn't increase. I don't know what is the problem. I also have one additional question - how can I find Greeks(Delta,Vega,Gamma,Theta,Rho) with Monte Carlo simulation on this model? Here is my code:
function [Price]= BlackScholes (n,m,r,T,Var,S0,K,B)
Price=1:50;
for i=1:n
I=1;
for j = 0:(m-1);
Z(j+1)= randn (1 ,1);
dW=sqrt (T/m)*Z(j+1);
if j==0
S(j+1) = S0*exp((r-Var/2)*(T/m)+sqrt(Var)*dW);
if (I==1) & (S(j+1) <= B)
I = 0;
end
else
S(j +1) = S(j)* exp ((r - Var /2) *(T/m) + sqrt ( Var )* dW);
if all([ I==1 , S(j+1) <=B])
I = 0;
end
end
end
C=zeros(n,1);
C(i)= exp(-r*T)* max ((S(m-1)-K), 0)*I;
Price = sum (C (1:n))/n;
end
Thanks a lot!