Monte Carlo simulation particular call option

Hello, I'm trying to compute the price of a particular call option using a Monte Carlo simulation. I'm struggling because the strike (K) is defined as the lowest price the stock has taken between t=0 and maturity and I'm not able to code that correctly.

You'll find below my code. As you can see, with my actual code for K the problem is that it gives me a unique value for all the simulations but I need the lowest value of each random walk.

By the way, I need to do 1000 simulation and the steps need to be monthly so if you see another error not linked to the K please tell me :slight_smile:

Thanks in advance for your help

Here is my code :

S0 <- 100 #stock price at time 0
r <- 0.015
sigma <- 0.3
tau <- 2.25 #time to maturity
nSim <- 1000 #number of simulations
N <- 27 #number of subintervals
dt <- tau/N #length of subintervals
time <- seq(from=0, to=tau, by=dt)

Z <- matrix(rnorm(nSimN, mean=0, sd=1),nrow = nSim, ncol = N) #standard normal sample
dW <- Z
sqrt(dt)
X0 <- S0
W <- matrix(numeric(nSim*(N+1)), nrow = nSim, ncol = (N+1))
X_analytic <- numeric(nSim)
for(k in 1:nSim){
W[k,] <- c(0, cumsum(dW[k,]))
X_analytic[k] <- X0exp((r - 0.5sigma^2)tau + sigmaW[k,ncol(W)])
}
K <- min(X_analytic[k])
payoff_expiry_call <-pmax(X_analytic-K,0)
expected_payoff_call <- sum(payoff_expiry_call)/length(payoff_expiry_call)
Monte_Carlo_call_price <- exp(-r*(tau))*expected_payoff_call

1 Like

I am trying to learn how to use R to do the same thing

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.