I have a problem using the "fOptions" Package for R. While I use the built-in MonteCarloSimulator with it's standard innovations and path generator I change the Payoff Function to price Parisian Options. My Problem is that the MCSimulation overpices the Option by 0.2.
Now my Question is: Is the Code I wrote correct? It should do the following (it's part of a function, the other stuff is correct):
I get a vector "path", which is constructed from the exponent of a geometric Brownian Motian, so the first line changes this "path" to a vector containing the values of the Underlying.
I change path to be a 0-1 Vector containing 1s where the Underlying value falls below the barrier H.
I change path to be a True-False Vector containing the information if there are k or more consecutive steps in which the asset is below the barrier H.
If this is the case, set payoff to 0.
path = S*exp(cumsum(path)) path = (path <= H) + 0 path = (rle(path)$values[which(rle(path)$lengths >= k)] == 1) if (sum(path) > 0) {payoff = 0}
The code seems to be wrong for small k = 0, 1, 2, ... as the option prices underestimates the probability of a Knock-Out.
Thanks in advance for your help!
Edit: The path is generated via
wienerPath = function(eps) {
path = (b-sigma*sigma/2)*delta.t + sigma*sqrt(delta.t)*eps
path
}
where "eps" is a matrix filled with sobol low discrepancy numbers. the matrix which i get by running wienerPath is then inserted in my payoff function row by row, so "path" in the code in my original question is a vector.